Connecting a signal to a new button created in code. error: (Method expected 0 argument(s), but called with 1.)

Godot Version

4.6.1

Question

var booster_button = Button.new()
booster_button.pressed.connect(_on_boostery_button_pressed.bind(booster_button))
$Container/ScrollContainer/GridContainer.add_child(booster_button)

My program creates a button and im tryna connect a signal from it to the script creating the button. So I made an ofscreen dummy button to create the signal that connects to the main script and am now tryna connect that signal that dummy button creates to the one that script creates which seemingly works but every time i click the created button it gives me “Method expected 0 argument(s), but called with 1.” in the debugger, i havnt added any arguments to the signal i don’t know what that error could mean. Then again i also have no idea how bind or connects works or what a callable is so im prolly just outta my depth and dunno what to do but doing it like this worked before so i dunno.

Yes you have. You bound an argument when connecting to a callable using bind(). So _on_boostery_button_pressed() should be declared as receiving an argument. That’s precisely what the error message is telling you.

i thought thats what’s telling connect what its attaching to or smth ah well

Nope, it attaches an argument to the signal emission.