Lets say I have a function func_20 that calls func_19, that in turn calls func_18 and so on until func_1. The call stack is func_20 -> func_19 -> func_18 -> ... -> func_1. And they all use prop1:

func func_n():
    .........................
    .........................
    func_n-1()
    use_prop1()
    .........................
    .........................

Then at some point I change func_1 so it starts animation that changes prop1 and wait until the animation ends before it continues with whatever it is doing:

func func_1():
    .........................
    .........................
    start_animation()
    wait_for_animation_end()
    use_prop1()
    .........................
    .........................

How do I wait for this animation without making changes in other methods in the call stack?

You can use yield to do that, waiting for each animation to end, but you'll have to yield completely out of the methods, then resume them all. It would be a lot more straight-forward to separate the consecutive calls and use a method call at the end of the animation to start the next task. Godot is meant to be event-driven.

Out of curiosity, why would you need twenty consecutive calls?

    duane This means that every function should know that there will be animation (or yield) from the very start and it is simply not possible. You usually first add the functionality and then start adding things to improve the game experience, like better textures and animations. And it is hard for plan for all of this, especially in big game or if you idea evolves during the development process. Having to make changes all over the code in the entire project, just because of sigle change someware, is not ideal and might not be possible at all if different parts of the game are developed by different developers/teams.
    As for the 20 consecutive calls, it was to deter answers like yours that suggest splitting every function and yielding. I specifically asked "How do I wait for this animation without making changes in other methods in the call stack?". But it is also reality - I try to write small functions, that do one thing only and it leads to call stack of 4-6 within a single class. And when you have a function calling a function from another object and so on, it can quickly reach 20 or even more.

    As far as I know, there's no way in gdscript to halt a method and return to it other than yield, and that returns control to the calling method. Maybe C# would work better for you.

    C# has its own threading library with a traditional sleep function, so you could just sleep the method until the animation is over. Or loop a sleep until you get a signal from the animation, which would require more setup but you wouldn't risk getting out of sync if the animation runs longer or shorter for some reason.

    You can do it with GDScript too - OS.delay_msec(1000). But sleeping will block the thread and usually you are on the main thread, so it will freeze redrowing and input, and the animation 🙂
    I guess my problem is hard to solve. Maybe running everything on a separate thread and wait with semaphore that is post-ed at the end of animation or other action, but synchronization may end up way more expensive codewize.