deleting nodepaths

Is there an easy way to delete a nodepath but still use the variable with another?

This does not seem to work:

def deleteGeometry(self):
		self.coll_node = NodePath(PandaNode('collision'))
		self.back_node = NodePath(PandaNode('regular'))

That should certainly work. Python always allows you to completely redefine any variable, so when you reassign self.coll_node and self.back_node, it’s completely irrelevant what values they had before.

In what way is it not working?


In my code these are actually geomNodes, but they do not get deleted when this function is called…I then write the new geomData, but then both meshes are being rendered.

edit: I found the problem, I was forgetting to release the nodes from the list of all the geomnodes I created for testing purposes :smiley: