Having a scene singleton saves the scene but when I switch back it makes duplicates, how can I fix that?

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

If I make scene.tscn a singleton it saves the scene when I change to a different scene. But when I change back to the scene there will be duplicates. For example scene.tscn cotains a square that you can move. I first move the square right then I go to a different scene and back with get_tree().change_scene('res://scene.tscn') and there is 2 squares one is the newly spawned one and the other is the saved scene. I just want to switch back to the singleton not make a new scene. How can I do that?