[SOLVED?] Is there a way to delay an Ignition Gateway Script by 1 second

Good afternoon,

I want to delay the execution of an Ignition Gateway Script by 1 second. What is the best way to do that?


Delay it 1 second from what?

system.util.invokeLater takes an optional delay parameter in milliseconds, so if you’re calling a gateway script from a client you could use that, only has Vision Client scope however.


Or if you need pure python, something like this should work.

import threading
def delayedScript():
     #code you want delayed

The delay would be from the time the Gateway Script is triggered. The invokeLater looks promising for my application. I will try it out.

I am getting a message in the Gateway logs that there is no function invokeLater. Thoughts?

Invoke later won’t work unless in vision client scope.

What is triggering you’re script? Can you just make the trigger one second later. What is the end goal here?

1 Like

Please explain why you need to wait one second. Allowing something else with an indeterminate duration to complete? Communications of some kind, perhaps? That you think will be reliably with a one-second delay?

{ These exercises often blow up in people’s faces when the arbitrary delay turns out to be insufficient occasionally, but the 3x or 5x or 10x delay that is reliable is just too long. }

What sequence of events are you really trying to synchronize?


I knew you would show up Phil. I’ve read all your threads and not doing what I am trying to do… I was able to get our PLC group to voluntarily add the 1 second delay I needed making this thread pointless.

I need the delay because Ignition is reading one tag faster than another tag (a race condition).