We have some gateway scripts where we push some values into varaibles, maybe we can use a more efficient method, but we wanted to prevent constant tag reads, these functions are called fairly often and we'd rather not read the variable each time to reduce time.
I'm imagining if we restart the gateway scripts we can reload this api_root and keep it for the entire runtime. Maybe I'm wrong on how this works though.
e.g.:
#Used as a global value in all of our funtions
api_root = system.tag.readBlocking([x])[0].value
def some_func(...)
....
def some_func1(...)
....
def some_func2(...)
....
One of those functions could use the statement global api_root to make it writable within that function. Enabling you to update the value without a restart.
I think it is simpler to create a dictionary at the top level and just update various keys within it.