passing args to tasks

However, when I tried using Task() without passing the arguments, it gives me this error

That just indicates that you didn’t import Task as a class, you imported it as a module. That is to say, you did something like this:

from direct.task import Task

instead of this:

from direct.task.Task import Task

Note that there is a module named direct.task.Task, and that inside that module is a class named Task. If you do the first import, then the symbol “Task” refers to the module (and the class is named “Task.Task”), and if you try to call the constructor on a module, you’ll get the error you report. You have to do the second import to make the symbol “Task” refer to the class.

Actually, I don’t think it was working; you were just getting another, different error (World has no attribute time) before it got a chance to encounter the error with Task. You got this error first because putting the arguments there calls the function immediately, and therefore you discovered the error within your function before it had a chance to try to evaluate Task().

David