Passing Node/Nodepaths to other classes

i’m trying to pass a node (or nodepath, i always confuse the two…) to another class so that I can instantiate an instance of that other class at the location of the first class. ie. i want to create some light sources on the submarine and I have a class of lights so now I want to pass the submarine to that class so the lights can be created easily and handled within the light class rather than having to declare all the light attributes each time I want to add lights to something in my game

haha i really hope that made some sense… :smiley:

i’ve tried to pass the submarine to the light constructor but it says “argument 1 must be string or read-only buffer, not instance”

any ideas?

haha it really didn’t :confused:

If you want a child node to inherit from a parent node in the scenegraph then you have to reparent it to the parent (using the reparentTo() or attachNewNode() method on your child or parent nodepath, respectively ), but that’s not the same as class inheritance.

I don’t know if that answers your question.

just pass the NodePath to the funtion/class that sets the light…