Here is how to create a timer with code.
func _ready():
var timer = Timer.new()
timer.wait_time = 2.0
timer.connect("timeout", self, "timer_done")
add_child(timer)
timer.start()
func timer_done():
print("timer done")
However, in a real game it would be easier to just add a Timer node to your object (that way you don't have to be creating and deleting timers all the time). So you can add a Timer node as a child to the object, then set One Shot to on (so it doesn't loop) and set the Wait Time to the seconds you wish to wait.
onready var timer = get_node("Timer")
func _ready():
timer.connect("timeout", self, "timer_finished")
func start_timer():
timer.start()
func timer_finished():
print("timer finished")