How to reset a battle scene after pressing the proceed button?

I’m trying to make a history trivia game with turn-based RPG elements. A problem I am currently working on is resetting the battle scene node when battle finishes so it can be reused for the next enemy.

Here’s what I’ve tried to reset it:

var battle_screen = preload("res://Battle Scene Level 2.tscn")
var t = battle_screen.instance()

func _on_Proceed_pressed():
	if t:
		t.queue_free()
	t = battle_screen.instance()
	add_child(t)

I can’t manage to get it to work. Help would be greatly appreciated!

Edit: The battle scene is already present in the tree so an instance of it exists when I start the game.

maybe you should use

var t = battle_screen.instantiate()

instead of

var t = battle_screen.instance()

It says its a nonexistent function

That’s for Godot 4, this is Godot 3, can’t help you though you aren’t explaining what’s not working

The implementation I tried doesn’t reload the scene to its default state. The last state of the battle scene after the first battle remains when a second battle is triggered.

Try removing it before calling queue_free