Why my Sequence test program does not work?

Here is the code:

from direct.showbase.DirectObject import DirectObject
from direct.interval.FunctionInterval import Wait
from direct.interval.IntervalGlobal import *
from direct.showbase.ShowBase import ShowBase

class TestingPrint(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
           
        self.testSeq()

   
    def testSeq(self):
        self.seq=Sequence()
        self.seq.append(Func(self.testPrint()))
        self.seq.append(Wait(2))
        self.seq.append(Func(self.testPrint()))
        self.seq.start()


    def testPrint(self):
        print('jojo')

app = TestingPrint()
app.run()

Says error:
File “H:\Panda3D-1.7.2\direct\interval\FunctionInterval.py”, line 305, in init
assert hasattr(function, ‘call’)
AssertionError
:TaskManager: TaskManager.destroy()

Actually, before that error I bet it prints ‘jojo’ once. You’re calling the function and passing the return value (None) to the Func constructor. You want to pass the actual function:

# referencing a method: self.testPrint
# calling a method: self.testPrint()

self.seq.append(Func(self.testPrint))

Hollower, Thank you!

And there was a ‘jojo’ once, as you said, buried to error prints.