Guys, guys, you’re overcomplicating this. Here’s a simple solution. It even lets you specify the wanted completion time:
func _process(delta):
if Input.is_action_just_pressed("interact"):
if await spacebarheld(5.0) >= 1:
print("COMPLETED")
func spacebarheld(duration):
await get_tree().process_frame
interact_progress_bar.ratio += get_process_delta_time() / duration
return interact_progress_bar.ratio\
if Input.is_action_just_released("interact") or interact_progress_bar.ratio >= 1\
else await spacebarheld(duration)