I do not see a problem. The code should work as expected
I suggest you add some prints before and directly after setParent(), showing the names and ids of each participating object.
e.g.
Thanks Monster! Yes, I was too concise, I apologize
The context is quite complex, I want to dynamically display a icon (bkgObj) plus a text (the node name, nodNameObj), so I put them in a class container (the “self”). During its init(self,…) they are created by means scene.addObject. The objects are fine created: they have different ID, they are displayed, i can destroy them, i can move (individually), set visible or invisible,… BUT the parent!
I’m trying everything: change the variables name, check all the ID,… The scene where I add the objects is not the currentScene so I simulated it in debugging files but don’t find any problems. May be is there a flag in the blender that prevents the setting of parents? I don’t know what are the differences between debugging files and main project…
It should be a very simple one, demonstrating the problem only. I’m not interested in your meshes, texture, sounds and any objects/logic that is not related to your problem.
(Hint: while preparing this file, you might discover the solution for your problem by yourself. If not we can check it)
It seems to be a problem with objectsInactive list, try to use a string instead like:
dad = scene.addObject("bkgObj" , scene.objects["builder"]
Edit: looking at your code again, you’re setting parent after printing?
I’m sure this isn’t a bug, I was doing something similar recently that involves parenting added objects.