Storage of variables to implement toggle switch

I currently have two TouchBar buttons each calling an apple script (one for enabling and one for disabling a function).

I'd like to combine both buttons into one toggle button. I have however no chance to determine from BTT whether the function is already active or not. So I was thinking that if I could store a bool variable within BTT, I could use that to determine whether to call the enable or disable apple script.

Any thoughts how to do this?

You'd have to have the applescript gather the info every time and compare against something statically defined within the script.