Gateway Startup Script not working

I have a Driven scan class setup for Configuration tags that rarely need to be scanned for changes. (Anyone familiar with the AB PlantPAX AOI’s knows there are a lot of cfg tags that don’t need to be scanned all the time.)
It has a driving tag set to any change that will execute the scan.
I have tried this with 2 different scripts. Both work fantastically when tied to a button.

system.tag.scan("Scada", "ConfigChange")
PushTag ="PushConfigChngs").value

if PushTag:

I’ve tried them both in the gateway startup script and neither one will cause the scan class to scan when the Gateway is started. The strange thing is, when using the second script, I can see that my driving tag did toggle states, but it just didn’t fire the scan. and my associated tags are all “null”

Is there some timing reason this will not work in the gateway startup script? Is there another way to scan this class once when the gateway is first started up?


I’ve also run into problems with a Gateway Startup Script not working as intended, I think it has to do with some things loading faster than others, like tag providers, etc. I’m not sure on that but if anyone wants to chime in on that.

My workaround involves using a threading Timer to delay the running of the script which works for me, but I’m not sure of its robustness. Again if anyone wants to chime but this is what I got to work.

def delayedFunction(args):
    from threading import Timer
    t = Timer(delay in seconds, function, [args])

And then I just call that function in the startup script.

1 Like

Also came across this.