Interaction Question in GD 4

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GodotNewcomer

I was recently watching a video where a person was using this code to add interactions such as when its colliding with a certain object and when pushing a certain button, something happens.

func _physics_process(_delta):
prompt.text = ""
if is_colliding():
	var detected = get_collider()
	
	if detected is Interactable:
		prompt.text = detected.get_prompt()
		
		if Input.is_action_just_pressed(detected.prompt_action):
			detected.interact(owner)

[This code is from a video by Nagi]
When trying to use this code in Godot, I got stuck on the part where it could not print out the detected.get_prompt() at all. Is there a way to fix this, or is there a different way to add interaction?