"Node not found" when node definitely exists

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

I have this scene, which is autoloaded:

CanvasLayer (root with attached script)

  • AnimationPlayer (Schrodinger’s node)
  • Control (presumably unrelated stuff)
  • ColorRect

but whether I reference AnimationPlayer in the script linked to CanvasLayer with

$AnimationPlayer

or

get_node("AnimationPlayer")

or

get_node("/root/Scene/AnimationPlayer")

(which I think all refer to the same AnimationPlayer node as in the autoloaded scene?), I am getting “node not found: AnimationPlayer”. It’s treated like it exists in the IDE autofilling functions, etc. and worked before I changed the file structure (and also updated all location references I could find), but now it seems to refuse to acknowledge this node.

Why is it no longer working? How do I fix it? What embarrassing noob mistakes have I made with my structures?

:bust_in_silhouette: Reply From: Newt

Fixed it myself!

I did make an embarrassing mistake.

I autoloaded the script instead of the scene. :facepalm: