# 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.

Source: https://flockbay.com/godot/how-to-connect-signals-in-code-in-godot-4/ · Updated 2026-10-30

## 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.

```
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

```
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.

```
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

```
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.

```
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.

```
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](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_analyzer.cpp#L3475), [Signal.connect in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Signal.xml).

## 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).

Download Flockbay free: Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot. https://flockbay.com/download/

Related: [In Object of type '…': Attempt to connect nonexistent signal '…' to callable '…' in Godot 4](/godot/attempt-to-connect-nonexistent-signal/), [Signal '…' is already connected to given callable '…' in that object in Godot 4](/godot/signal-is-already-connected-to-given-callable/), ["yield" was removed in Godot 4. Use "await" instead: how to wait](/godot/wait-in-godot-4-await-instead-of-yield/), [How to tween in Godot 4: create_tween() and tween_property()](/godot/how-to-tween-in-godot-4/), [Every verified Godot 4 answer](/godot/), [How do I connect Claude Code to Godot?](/docs/how-do-i-connect-claude-code-to-godot/)
