accessing a model class instance

so, wich should be the best way to access the class instance form wich we created the model?

let’s say we have the class:

class Ralphito:"Iamtheone"
    self.age=99 = Actor("ralph",{"walk":path+"-walk","run":path+"-run"})

and then we pick with the mouse in ralph model, so we know the model, but, how do we know the class instance that generated that model for being able to access to ralph properties?

I tryed to assign the class with setTag but only accepts string data…

probably someone knows already some trick about that?

use NodePath.setPythonTag() and NodePath.getPythonTag() instead. :slight_smile:

eeehhh niceeee :smiley:
thanks mind!

Another neat thing you can do is set up the destructor of your class to automatically remove your model for you, then (usually) doing: “del classInstance” will remove your class instance and the view model with a single command.

Not a good idea, since if you make your own destructors, python won’t garbage collect your stuff anymore.
Instead, make a .cleanup() or .destroy() function which does so, so you need to call that one before you actually delete it.

sorry guys, i was in an onsen in the mountains regenerating the neurons : )
thanks a lot for the tips, i’ll take them in count!