doMethodLater ... function never gets called

Hi all,

I’m trying to run this simple script below, but for some reason myFunction never gets called.
With DirectStart it is working, but at the moment I don’t want to use DirectStart. :cry:

It somehow works withpout DirectStart if I use a negative number, but that isn’t right.

Maybe someone can help me.


used system:
Windows XP SP3
Python 2.6.6
Panda3D 1.7.0

# coding=cp1250

from direct.task.TaskManagerGlobal import taskMgr
from direct.task import Task

def myFunction():
    print "... counting ..."
    return Task.cont

myTask = taskMgr.doMethodLater(1, myFunction, 'tickTask')

So I figured that the default task chain is not ticking:
If I do something like the below, it’s “working”:

# coding=cp1250

from direct.task.TaskManagerGlobal import taskMgr
from direct.task import Task
from panda3d.core import ClockObject 

def myFunction(task):
    print "... counting ..."
    return Task.again

myTask = taskMgr.doMethodLater(2, myFunction, 'tickTask')
globalClock = ClockObject.getGlobalClock()

while 1:

But I would like to simply do a :confused:

Hi again,

still can’t simply do a but if I use setTickClock(True) on the default chain it works:

chain = taskMgr.mgr.findTaskChain("default")

Is it possible to get this to work without findTaskChain?

It is certainly possible. It means you have to do the setup stuff that would normally be done by importing DirectStart (or by creating a ShowBase instance). But why not just import DirectStart (or create a ShowBase)? This sets up all sorts of useful things that many subsystems in Panda assume will have already been set up.

If your only goal is to avoid opening a window, set “window-type none” in your Config.prc, before you import DirectStart. Plenty of examples of people doing this in the forums.


I’ll later probably go with an instance of ShowBase but for some tests it would be nice if the code could be as lean as possible.

I looked through but unfortunately didn’t find anything besides the Clock/tick stuff.

Anyway - for the tests, it’s working. :slight_smile: