[imports ....]
LAST_SELECTION = {
'project': {},
'category': '',
'entities': [],
}
def CustomCommand_Execute():
global LAST_SELECTION
[Do some modifications to LAST_SELECTION]
My experience with global variables in scripting is softimage treats them like static declared variables from C/C++. The variable is initialized once, then cached for all future invocations of the script during the user session. They are not de-referenced when the script terminates/completes.
This mainly applies to scripts run from the script editor directly. Global variables inside of self installing plugins should work as expected.
Matt
from win32com.client import constants
constants.__dicts__.append({'PLUGIN_GLOBAL_SCOPE': None,'project': {},'category': '','entities': []})
container = [d for d in constants.__dicts__ if 'PLUGIN_GLOBAL_SCOPE' in d][0]