Only second instantiation of scene throws null reference error

Godot Version

godot 4.5

Question

I’m currently trying to make a level instantiator (to move between areas in a zelda-like) for my little pet project but for some reason trying to instantiate a scene the second time throws a null reference error?
As in the scene is instantiated once using a custom method(below), but if I call the custom method again with the same input parameters the native godot instantiate method throws an error?

func _load_new(newScene : PackedScene, spawn : int):
	if scene != null:
		scene.queue_free()
	print(newScene)
	scene = newScene.instantiate()
	add_child(scene)
	player.position = scene.spawns[spawn].global_position

Avoid preloading or @exporting the packed scene. These force the resource to be loaded as part of the original scene, which causes a cyclical dependency.

Maybe your _load_new should take a String and load the scene just before instantiating.

good call, thanks