Actor reference

Doing my first steps in learning Panda3d I copied the tutorial code and give it a go. It works well using the exact code from the tutorial page but being a lazy programmer I didn’t use object attributes to store the actor object. I was surprised to see that the actor doesn’t animate in this case. As soon as I keep a reference to the object it works again. It’s kind of magic and I was wondering if someone can explain to me what’s going on. I suspect the Actor object is somehow GCed but I don’t understand why this happens because it was added to the render tree.
You can see the code posted here:
pastebin.com/UJCWwmC6

Actor is a Python class that wraps NodePath. So it isn’t added to the scene graph itself, only the nodes that operates on are. This clunky design has the result that the Actor class is destructed when no reference to it is kept.

The easy way to fix this is by storing it as self.actor.