Process "Node not found" error

Hello, new to Godot, don’t blame me.
Have a problem. I trying to call function from node, that I will instantiate from another scene in the code. But if I will run function before this, it’s will, obviously, produce error.

How to process this, and just skip the code?

If I understand your question correctly, it sounds like you have a variable that is initially null and is later given a value - is that right?

If so, you’ll need to check that it is not null before calling the function:

var my_node: Node
if my_node != null:

You can also use has_method to detect whether a method exists for a given object:

if my_node.has_method("foo"):
1 Like

Ah yes, lazy me. Thank you for your answer.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.