Pulse Works Studio

Can't use get_node() with absolute paths from outside the active scene tree.

An absolute node path only works after the node has entered the tree.

Cause

Node.get_node rejects a path that starts with / when the caller is not inside the tree, because /root does not apply yet. The usual trigger is an absolute path from _init or from a node that has not been added. Use a relative path, or wait until _ready.

Fix

func _ready() -> void:
	var hud := get_node("/root/Main/HUD")
	print(hud.name)

func configure(parent: Node) -> void:
	parent.add_child(self)
	var hud := get_node("../HUD")
	print(hud.name)

Related

Godot Dev Tools is a Pulse Works Studio project. All error explainers.