Suppose the scene tree is
Node
Node/Node
Node/OtherNode
Node/Button
and suppose you want code in Node/Node's script to do the job of connecting the Node/Button's pressed
signal to the function button_got_pressed
in Node/OtherNode's script.
Then you would write something like this in Node/Node:
func _ready():
var button = get_parent().get_node("Button")
var other_node = get_parent().get_node("OtherNode")
button.connect("pressed", other_node, "button_got_pressed")
and the script on Node/OtherNode would have something like this
func button_got_pressed():
print("button got pressed")