Force restart gateway scripts from scripting?

Hey all,
When you save a project the project will automatically restart all of the projects gateway scripts.

We have a use case where we would like to manually trigger this to occur, but I can't find anything relevant in scripting like system.util....

Is this a feature we can add?

This sounds like an XY problem. Why do you want to restart scripts on demand?

4 Likes

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.

4 Likes