Get position of object

earthnode is not defined in the scope of Asteroid.init() It doesn’t know what you mean by “earthnode” at that point. It looks like it’s only defined in SinglePlayer.init() (I’m assuming the code formatting screwed up and you’re not actually trying to create earthnode as a module level variable) When SinglePlayer.init() finishes, the local earthnode reference is lost. It looks like you have another reference to the actual object in the “planets” list. Perhaps you could look it up through there.

Try reading up on python scope rules if you’re still confused.