As xyz said, you can connect nodes which are not in parent/child relation.
Here you got example of siblings (script is attached to parent):

extends Node2D
func _ready() -> void:
$A.connect("button_down", $B, "hide")
$A.connect("button_up", $B, "show")
$B.connect("button_down", $A, "hide")
$B.connect("button_up", $A, "show")