Callable Function Error

v4 1.3 Godot Version

So I recently started using Godot and I have fun coding and testing it out but I have had problem with my code right now. I followed a tutorial for interactable objects but I run into a error whenever I launch the scene with said interactable object. Here is the code for the interactable object, interaction manager, and interaction area code.

Interactable object:
extends StaticBody2D

@onready var interaction_area = $InteractionArea
@onready var sprite = $AnimatedSprite2D

func _ready():
interaction_area.interact = Callable(self, “_toggle_chest”)

func _toggle_lamp():

Interaction Manager:
extends Node2D

@onready var player = get_tree().get_first_node_in_group(“player”)
@onready var label = $Label

const base_text = "[E] to "

var active_areas =
var can_interact = true

func register_area(area: InteractionArea):

func unregister_area(area: InteractionArea):
var index = active_areas.find(area)
if index != -1:

func _process(delta):
if active_areas.size() > 0 && can_interact:
label.global_position = active_areas[0].action_name
label.global_position = active_areas[0].global_position
label.global_position.y -= 36
label.global_position.x -= label.size.x / 2

func _sort_by_distance_to_player(area1, area2):
var area1_to_player = player.global_position.distance_to(area1.global_position)
var area2_to_player = player.global_position.distance_to(area2.global_position)
return area1_to_player < area2_to_player

func _input(event):
if event.is_action_pressed(“intereact”) && can_interact:
if active_areas.size() > 0:
can_interact = false

		await active_areas[0]
		can_interact = true

Interaction Area:
extends Area2D
class_name InteractionArea

@export var action_name: String = “Interact”

var interact: Callable = func():

func _on_body_entered(body):

func _on_body_exited(body):

Sorry if this is an easy fix to be made and here is the tutorial if anyone is wondering. Thanks for the help.

the video is unavailable

does this work?

I’m sorry, but what is the error? I didn’t see the description of the problem in your post.

1 Like


These are the errors I run into whenever I run the project

second reply cause i couldn’t put both in the same post

can you show your scene tree?

right here

To help yourself and others, use three backticks, the button to the left of your 1 key on either side of your code to put it in a block

func like_this():


You’re trying to create a reference to _toggle_chest function but this object has no such method, it only has _toggle_lamp.

Btw, try to avoid referring to method names inside strings like a plague. If you use another constructor Callable offers, you’ll catch this problem right away at code time, like so:

interaction_area.interact = Callable(_toggle_lamp)

Strony typing saves lives!

1 Like

Thank you but I still am running into the same error when I replaced the line of code with the one you suggested.

extends StaticBody2D

@onready var interaction_area = $InteractionArea
@onready var sprite = $AnimatedSprite2D

func _ready():
	interaction_area.interact = Callable(_toggle_lamp)

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _toggle_lamp():

Sorry for the long wait for the reply I been away from my pc from Winter Break so wasn’t able to actually test it out.

where is the InteractionArea named Node here?

as z said above, in line:

@onready var interaction_area = $InteractionArea

The “$InteractionArea” part is wrong. You must have moved InteractionArea in the tree without updating this path. You can either type “$./” and find Interactionarea in the list that pops up, or delete the line and click on InteractionArea in scene tree and drag it into code while CTRL is pressed (CMD on Mac), release mouse button while still pressing CTRL, and it will write @onready line for you with proper path.