get_node() not registering location

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

I’m trying to access a timer, but get_node() can’t find my object.

Here is my code:

onready var timer = get_node(“/root/Main/Timer”)
My path is:

Main

------Gun

------Timer

Just know that I’m new to Godot.

:bust_in_silhouette: Reply From: RaebaldKashban

What script are you calling “get_node” from? Your syntax appears to be correct.

One possible explanation for your problem is that you’re calling get_node before the timer has been initialized in the SceneTree. Knowing more about where “get_node” is being called from could help troubleshoot that possibility.