$AnimatedSprite
means "get a node called 'AnimatedSprite' that's a child of this one".
Since your script starts with extends AnimatedSprite
, it appears that this script is attached to the animated sprite, not the parent of one.
If that's the case, then you can just call play()
and stop()
without getting any node.