Skip to content

How to connect signals in code in Godot 4: signal.connect(callable)

By Eduardo Orellana · Updated

Connect through the signal and pass the method itself: timer.timeout.connect(_on_timeout). The Godot 3 form connect("timeout", self, "_on_timeout") fails to parse in Godot 4, with Invalid argument for "connect()" function: argument 2 should be "Callable" but is "res://…" among its errors.

AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.

Intel or AMD Chromebook, with Linux turned on.

Download for macOSDownload for WindowsDownload for Linux

What Godot is checking

In Godot 4 a method is a value, a Callable, and signals are properties of their object. Object.connect() takes the signal name, a Callable and flags; passing the target object and a method name, as Godot 3 did, gives the wrong types for arguments 2 and 3.

timer.timeout.connect(_on_timeout) is checked when the script loads: a misspelled signal or method is a parse error instead of a silent missing connection.

Extra arguments go on the Callable: button.pressed.connect(_on_button.bind(3)) calls _on_button(3).

Reproduce it

A Godot 3 signal connection, in a Godot 4 project.

GDScript
extends Node

func _on_timeout():
	print("timeout")

func _ready():
	var timer := Timer.new()
	add_child(timer)
	timer.connect("timeout", self, "_on_timeout")

What Godot 4.7.2 prints

Output
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

SCRIPT ERROR: Parse Error: Invalid argument for "connect()" function: argument 2 should be "Callable" but is "res://answers/how-to-connect-signals-in-code-in-godot-4/repro.gd".
   at: GDScript::reload (res://answers/how-to-connect-signals-in-code-in-godot-4/repro.gd:9)
SCRIPT ERROR: Parse Error: Cannot pass a value of type "String" as "int".
   at: GDScript::reload (res://answers/how-to-connect-signals-in-code-in-godot-4/repro.gd:9)
SCRIPT ERROR: Parse Error: Invalid argument for "connect()" function: argument 3 should be "int" but is "String".
   at: GDScript::reload (res://answers/how-to-connect-signals-in-code-in-godot-4/repro.gd:9)
ERROR: Failed to load script "res://answers/how-to-connect-signals-in-code-in-godot-4/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

Connect the timer's timeout signal to the method, and a second connection with a bound argument.

More on this: "yield" was removed in Godot 4. Use "await" instead: how to wait

GDScript
extends Node

func _on_timeout() -> void:
	print("timeout")

func _on_tick(id: int) -> void:
	print("tick from ", id)

func _ready() -> void:
	var timer := Timer.new()
	timer.wait_time = 0.1
	timer.one_shot = true
	add_child(timer)
	timer.timeout.connect(_on_timeout)
	timer.timeout.connect(_on_tick.bind(7))
	timer.start()

What the fixed script prints

Output
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

timeout
tick from 7

Run this fix with your agent

Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.

Prompt
How to connect signals in code in Godot 4: signal.connect(callable) Connect through the signal and pass the method itself: timer.timeout.connect(_on_timeout). The Godot 3 form connect("timeout", self, "_on_timeout") fails to parse in Godot 4, with Invalid argument for "connect()" function: argument 2 should be "Callable" but is "res://…" among its errors. Where this calls for a change in my Godot 4 project, make it, then run the game headless and check Godot's output for errors.

Connecting with a lambda

A short handler can be written in place: timer.timeout.connect(func(): print("done")). Keep a reference to it if you need to disconnect it later.

More on this: Too few arguments for "…()" call. Expected at least N but received M in Godot 4

GDScript
var on_done := func(): print("done")
timer.timeout.connect(on_done)
timer.timeout.disconnect(on_done)

Verified on Godot 4.7.2

Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 18 October 2026, and the output above is what Godot printed, unedited.

Where the check lives in Godot's source: gdscript_analyzer.cpp line 3475, the message, Signal.connect in the class reference.

Questions

How do I connect a signal only once?
Pass CONNECT_ONE_SHOT: timer.timeout.connect(_on_timeout, CONNECT_ONE_SHOT). It disconnects itself after the first emit.
How do I connect a signal from another node?
Through that node: $Player.died.connect(_on_player_died).

Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.

Download Flockbay free