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

**URL:** <https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [February 21, 2022, 7:41pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388 "2022-02-21T19:41:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 21, 2022, 7:41pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/1 "2022-02-21T19:41:30Z")

</div>

Good afternoon,

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

Thanks.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 21, 2022, 7:52pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/2 "2022-02-21T19:52:34Z")

</div>

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.

```python
system.util.invokeLater(scriptName,1000)

```

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

```python
import threading
def delayedScript():
     #code you want delayed
threading.Timer(1.0,delayedScript).start()

```

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 21, 2022, 7:53pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/3 "2022-02-21T19:53:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 21, 2022, 7:56pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/4 "2022-02-21T19:56:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 21, 2022, 8:07pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/5 "2022-02-21T20:07:49Z")

</div>

> [@lrose](#):
>
> only has Vision Client scope however.

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

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 21, 2022, 8:11pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/6 "2022-02-21T20:11:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 21, 2022, 8:21pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/7 "2022-02-21T20:21:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 21, 2022, 8:51pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-delay-an-ignition-gateway-script-by-1-second/56388/8 "2022-02-21T20:51:20Z")

</div>

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).
