How to change node godot code example
Example: How to create a new node in godot
var node = Spatial.new()
# the parent can be get_tree().get_root() or some other node
parent.add_child(node)
# ownership is different, I think it's not the same root as the root node
node.set_owner(get_tree().get_edited_scene_root())