How to hide/ make invisible an arbitrary node inside my scenetree from a singleton script/ with signals?

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

I have a scrollcontainer that is inside a canvas layer which is attached to the player. Per default it is invisible an shall only only show up when a certain button is pressed ( I make it visible with ‘that_container’.visible), and hide again, when I chose something from it. I load its options from a json and everything appears just fine, but it does not disappear after the selection. What I tried so far:

  1. inside my global singleton:
var cont = get_node(path_to_thecontainer)
cont.visible = false (alternative: cont.hide())

absolutely no effect (path is correct, quadrupel checked it)

2 define a signal inside my global singleton:

signal done_choosing
emit_signal("done_choosing") #after the selection happenend (it does happen, did check this like a million times, so the signal should be emitted just fine)

then (alternative a) in my script attached to the container:

ready():
self.connect("done_choosing", self, "make_invisible")

func make_invisible():
self.hide() # or self.visible = false 

no effect… again
alternative b inside the script of my UserInterface

_ready():
var cont = get_node(path_to_thecontainer)
cont.connect("done_choosing", self, "make_invisible")

func make_invisible():
var cont = get_node(path_to_thecontainer)
    cont.hide() # or cont.visible = false

nada. Well I tried to put a print(“Hi”) inside the make invisible function, which did not even once appear in the output window. Therefore, I think there is something wrong with my signal approach in general.

So these are all the ways I could possibly think of to get this done. I would appreciate any hints or alternative ways to do this.

:bust_in_silhouette: Reply From: Ciavarie

Ok I solved the issue myself. For anyone, who runs into the same issue:
My mistake was to connect the signal to the scrollcontainer instead of connecting it to the autoload script from where the signal is emitted.