Finishing cycle of looping animation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By godot.ma.desive.logo

Hello,
I have some looping animations. I play f.e. animation $T and sometimes I want to play another. But firstly I need to finish the first animation (finish one cycle of the loop). I tried to set the loop on false, but it gives me a mistake. Here’s a code:

if something:
   $T.set_animation_loop("animation1", false)
   yield($T, "animation_finished")
   $T2.play()
   $T.set_animation_loop("animation1", true)

Could anybody help?