Why is the signal not emitted?

Godot Version



I am currently trying to fire a random signal from the possibilities for TicTacToe against AI. Unfortunately, my own signal is not emitted when I put the signal together via strings. However, I can emmit a signal that is created by godot. Is what I am trying to do simply not possible or do I have a bug in my code? I am still a beginner and unfortunately I don’t know how I could solve it differently. Thank you for your help!

func choose_option():
	var CPU_Click = options.pick_random()
	var ClickedButton = get_node("Playground/b" + str(CPU_Click))
	var Testing = "1_1"
	print("CPU Click: " + str(CPU_Click))
	print("Clicked Button: " + str(ClickedButton))
	print(str("_on_" + CPU_Click + "_pressed"))
	ClickedButton.emit_signal("_on_" + CPU_Click + "_pressed")
	ClickedButton.emit_signal("_on_b_" + Testing + "_focus_entered()")

func _on_b_1_1_focus_entered():

Console Output:

CPU Click: 2_2
Clicked Button: b2_2:<Button#33319552279>

Can you show the ClickeButton code? The code has a _on_2_2_pressed signal created? Because this looks more like a function name than a signal name, if this is the case you don’t want emit a signal, you want to call a function and for this you can use ClickedButton.call("_on_" + CPU_Click + "_pressed")

That’s not how you create custom signals and emit them. Check this documentation page Using signals — Godot Engine (stable) documentation in English where it explains how signals work and how to create custom ones.