Are your nodes to be dynamically instantiated? I.E. will “Earth” always be there, under “Galaxy”? If so, maybe you should save the node path from .get_path(), you can remove the if node.scene_file_path.is_empty(): block.
.get_path()
if node.scene_file_path.is_empty():
Make sure to paste code instead of screenshots