That has nothing to do with the import, just how you name your variables. For example:
mytask = taskMgr.add(self.doTask, "myTask")
def doTask(self, task):
(...)
return task.cont
but:
mytask = taskMgr.add(self.doTask, "myTask")
def doTask(self, Task):
(...)
return Task.cont
When you start a task via add the function automatically receives the task variable which internally you can name however you want. If you want to pass extra variables and the task object, you have to explicitly state so:
mytask = taskMgr.add(self.doTask, extraArgs=[1.0], "myTask", appendTask=True)
def doTask(self, number, task):
print number
return task.cont
The print should print 1.0. The add passes an extra argument as well as the task argument. Here the task argument comes last.
mytask = taskMgr.add(self.doTask, extraArgs=[1.0], "myTask", appendTask=True)
def doTask(self, task, number):
print number
return task.cont
This should not work as hoped. Here the print statement will print something every frame when the task is executed. Print task.cont will fail because the passed integer has no cont variable.
See this one, where the function receives three kind of variables: One passed from the task add, one optional parameter and the task object:
mytask = taskMgr.add(self.doTask, extraArgs=[1.0], "myTask", appendTask=True)
def doTask(self, number, trigger=2.0, task):
print number
return task.cont