Multiple Inheritance

Is there a way to have a class inherit 2 base classes?

I am trying to do the following:

class NPC(FSM.FSM , DirectObject):

However I get the following error message:
TypeError: Error when calling the metaclass bases
module.init() takes at most 2 arguments (3 given)

Thank you

I have also tried adding init functions like the following, but have not got any further.

class NPC(FSM.FSM , DirectObject):       
    def __init__(self):        
        DirectObject.__init__( self )

That’s the right idea.


Any idea what I am missing there? I get the same error. I’m stumped on this one.

I guess the DirectObject you imported is the module, not the class :

just import the class, not the module :

from direct.showbase.DirectObject import DirectObject

why do you need DirectObject at all?

Thanks that worked.

I was using DirectObject to accept events