i'm not getting timerout signal

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Thakee Nathees
func test():
	var timer = Timer.new()
	timer.one_shot = true
	timer.wait_time = .1
	for i in range(10):
		print(i)
		timer.start()
		yield(timer, "timeout")

in the above code, it only print 0. but i want it to print form 0 to 9 with .1 second intervals. is there any bug in my code? need help!!

:bust_in_silhouette: Reply From: kidscancode

Timer is a Node and must be added to the scene tree in order to work.

var timer = Timer.new()
add_child(timer)