I'm trying to put a node under another parent from script, but surprisingly I got many errors.
First, I tried:
new_parent.add_child(node)
But the debugger says: "node already has a parent".
Ok, so I try to remove the node from its parent first:
node.get_parent().remove_child(node) # error here
new_parent.add_child(node)
But again, error: This function can't be used during the in/out signal.
I seem to get the behaviour I want, but something went wrong, and I want to know how to change the parent properly?