Is it possible to add only the children of the scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bgegg

i can not add other scene(Spatial.tscn) by this code.
main scene do not have children .

extends Spatial

var get_scene
var scene_instance

func _ready():
	get_scene = load("res://0_practice_folder/get_scene/Spatial.tscn")
	scene_instance = get_scene.instance().get_node("MeshInstance")
	add_child(scene_instance)
	print(self.get_children())

but this code is work.

extends Spatial
    
var get_scene
var scene_instance

func _ready():
	get_scene = load("res://0_practice_folder/get_scene/Spatial.tscn")
	scene_instance = get_scene.instance()
	add_child(scene_instance)
	print(self.get_children())

can i add only children of Spatial.tscn?

:bust_in_silhouette: Reply From: Dlean Jeans

You gotta remove it from its parent first before adding it as child:

scene_instance.get_parent().remove_child(scene_instance)
# then
add_child(scene_instance)

Thank you very much.
parent results is null.
Spatial.tscn have node tree like this.

Node
    MeshInstance

bgegg | 2019-06-18 21:07