How to make the button turn on?

Hello!
Hello!
I wrote a script to turn off the inventory button, if it’s open, but I can not do it so that when I close the inventory the button is again active.
The GUI widget made a parent relative to the inventory widget and a variable of the button became available in the inventory widget

Sorry for my english, I’m using Google translator

GUI

Inventory