Weird method execution running...in parallel?

Version 4.3

Sorry, the title it’s a bit generic but it’s hard to describe without some code…

I do this:

var card = create_card()
print("pre animate")
animate_card_draw(card, hand_position)
print("post animate")

[...]

func animate_card_draw(card: Card, hand_position: int) -> void:	
	print("animate start")
	add_child(card)
	var tween: Tween = get_tree().create_tween()
	tween.tween_property(card, "position", hand_markers[card.hand_position].global_position, 1)
	await tween.finished
	print("animate end")

The output in console is:

pre animate
animate start
post animate
<and after the tween duration>
animate end

as a result if i do a loop to draw some cards i get the animations running in parallel while i want them to run one after the other to simulate drawing cards one by one.

That’s expected and normal, when you have an await in your function, you’re saying to the engine: “This function is an async function, you don’t need to wait for this finish to proceed the code execution” and that is what the engine do, if you want to wait the function finish everything you need to also await the function call:

var card = create_card()
print("pre animate")
await animate_card_draw(card, hand_position) # Await the function ends
print("post animate")

Oh wow thanks.
Thats’ slighlty counterintutive but well explained in the docs: