Today I have some touch bar buttons that act like toggles. e.g. "Mute microphone". I have a regex to change the icon and color of the button based on the result of an applescript that collect the input level of the device. I have chosen to trigger script every 1 second to change button appearance after my touch in a reliable way, but I feel that it would be more optimized if it simply have an option to refresh ("run script again") after a touch handling.
You can assign the predefined action "Run Apple Script", this will then be executed on button press and does update the widget in the same way as the widget script itself.
Alternatively if you don't want to duplicate your script you can use the refresh_widget function to refresh the widget with the given UUID, this will then run the widget script again immediately (also by assigning the "Run Apple Script" predefined action):
tell application "BetterTouchTool"
It worked like a charm, that option fits well for me.
I don't know if it is intuitive for people that are not software engineers and just copy some scripts from the web or here in the new repository of samples.