Your script is actually ON the
TextBox node itself. In that case, you don't want the
$ reference, as that's used to access children of the current node. Since your
TextBox node IS the current node, you can access its properties directly. So, instead of this.
text_box.visible = True
visible = True