Node not found: inheritance issue?

Godot Version

4.4.1

Question

I have three scenes, each one in it’s own subfolder… the scenes are A, B and C.

Scene A is derived from Sprite2d, it has a script attached

Scene B, which inherits from A and add a child control node (called “statusbar”)
Attached, there is a script that inherits from A, and in _ready uses get_node like this:

func _ready():
	fuel_ind_node = get_node("statusbar")

Scene C, which inherits from B setting a specific image to the Sprite texture.
C doesn’t attach any script, as it’s not needed.

Upon startup, i get a crash because:

E 0:00:03:593   B_scene.gd:11 @ _ready(): Node not found: "statusbar" (relative to "/root/scenec/C").
  <C++ Error>   Method/function failed. Returning: nullptr
  <C++ Source>  scene/main/node.cpp:1877 @ get_node()
  <Stack Trace> B_scene.gd:11 @ _ready()
            [ ... omitted irrilevant stack trace ... ]

What i am missing here?

Of course the B_scene script is called, because C inherits from B. But why get_node does return null? In th editor, i can auto-complete “statusbar” too, when i open scene B script.

If Scene C inherits from B and B has this function…

And if Scene C doesn’t have its own _ready() function, then it’ll use B’s _ready() function above. So it’s searching for a ‘statusbar’ node relative to the Scene C. And you probably don’t have this.

If you don’t want this, you can add a script with empty _ready() function to Scene C. So it won’t call inherited Scene B _ready() function.