In order to access a variable defined in the Worksheet script from a button script, you must specify the name of the worksheet along with the variable name as follows:
'Worksheet Name:Variable Name'
This can cause serious issues if the name of the worksheet is changed. Below is a sample script which sets a Worksheet script variable without having to hard code the name of the worksheet:
ON MOUSEUP
SELECT RANGE A1
RUN "'" & Name() & ":theVariable' = True()"
END MOUSEUP
There is one issue with this method. The Name() function returns the name of the currently selected object or the worksheet if no object is selected. If the current selection is not a cell when this script is run, therefore, it will not produce the desired result. This is why the first line of the above example selects the range A1. We could select any range here or, to be more sophisticated, check the type of the current selection (using the Selection() and IsRef() functions) and only select a cell if the current selection is not a range reference. The point is that we need to make sure that a range is selected so the Name() function returns the worksheet name and not some random object name.