How do you do this in Godot 4?

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

I’m trying to create a menu using the Menu Button node. I cannot figure out how to use get_popup().connect because it gives me the error: ‘Invalid argument for “connect”: argument 2 should be “Callable” but is “res//GD_Scripts/”’

:bust_in_silhouette: Reply From: spaceyjase
func _ready():
    get_popup().connect("id_pressed", _on_id_pressed)

func _on_id_pressed():
    # do amazing


get_popup().connect("id_pressed", func(): print("id_pressed!"))