Animation not visually appearing

Godot Version

4.5

Question

I am instantiating an object with the scene structure

(new users can only post one image) The main scene looks something like

Main (Node2D)
-Item Manager (Node2D)
–Item Spawner (Node2D)

the item is instanced in a code block in item spawner like

item = ITEM_SCENE.instantiate()
item.name = “item”
get_parent().add_child(item) #adds node to item manager

then an animation is played using the code

item.get_node(“AnimationPlayer”).play(“Animation”)

but the animation will not VISUALLY appear, the node2D’s children sprites do not play their animations which are just simple scale key frames

however printing things such as

for i in range(anim.get_track_count()):
print("Track ", i, " path: ", anim.track_get_path(i))
var anim = item.get_node(“AnimationPlayer”)
for t in anim.get_animation(“animation”).tracks:
 print(t.path)
 print(anim.is_playing(), anim.current_animation)

will all print as expected, giving true for anim.is_playing and showing all the node paths are correct and showing the correct tracks with the correct key frames

Process mode on all nodes is on inherit, i tried changing it to always, nothing changed.

I tried using the ready function to play the animation as the item is instantiated, it does not work however when creating an item instance in the main scene instead of instantiating it with code the animation works as expected

I tried deferring the playing of the animation to a deferred call but that didnt make a difference either

Another thing i tried was doing .stop(true) on the animation player then playing it, didnt work either

loop is on false

there is no RESET animation which might be overriding the animation i want to play

I tried recreating the animation and its tracks by deleting the animation player node and making a new one, did not work either

I am stumped, especially because in another part of my code I instantiate an identical node2D (not another instance of the same scene but another scene which is very similar in structure) and call the play animation in the same exact way and it works as expected but on this one the node2D is instantiated, the animation will apparently play according to the printed variables but visually the animation does not play

and yes i did make sure i was debugging the correct one so dont worry i didnt put the prints in the wrong function, both items that get instantiated from differents scripts appear on the screen but only one of them plays the animation despite having the animation play function called in the exact same way and I am stumped

Please format your code blocks properly using ``` tags, and post scene structures as scene tree screenshots.

So the problem was that I was also instantiating a child on the sub items node which for some reason prevents the animation from playing, setting the sub items node visible to false shows the animation as expected