Use a Timer
node to have a function happen every x seconds:
extends Node2D
var my_timer : Timer
func _ready() -> void:
var optional_parameter = 3
my_timer = Timer.new()
my_timer.autostart = true
my_timer.wait_time = optional_parameter # however many seconds you want
my_timer.connect("timeout", self, "my_function_to_call", [optional_parameter])
self.add_child(my_timer)
func my_function_to_call(secs):
prints("This is printed every", secs, "seconds.")