Create_timer doesn't work in a function

Godot Version

4.4.1.stable

Question

Hey. So i needed to use await get_tree().create_timer().timeout in my script multiple times, and decided to put it in a function

func wait(seconds):
	await get_tree().create_timer(seconds).timeout

but when i use the function it does nothing. What could the problem be?

Hi!

await works locally, so if you were to add a debug print call after the instruction, you’d notice it actually works.
To do what you’re trying to achieve, you need to call your function like this:

await wait(1.0)

Yeah that worked. Thanks a lot