# invokeLater function problem in script Library

**URL:** <https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207>\
**Category:** Ignition\
**Created:** [January 10, 2020, 11:04am UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207 "2020-01-10T11:04:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajesh.dayala](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@rajesh.dayala](https://forum.inductiveautomation.com/u/rajesh.dayala)\
**Post date:** [January 10, 2020, 11:04am UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207/1 "2020-01-10T11:04:03Z")

</div>

Hi,  
Can we use invokeLater function in project.scripts Library?

Because when i was trying to write values to certain tags, But it was not writing.

Thanks

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 10, 2020, 12:53pm UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207/2 "2020-01-10T12:53:13Z")

</div>

You might need to use a full context write, try including the tag provider in the tag path

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 10, 2020, 12:55pm UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207/3 "2020-01-10T12:55:11Z")

</div>

include the code to be able to meaningfully understand the problem

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 10, 2020, 1:18pm UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207/4 "2020-01-10T13:18:46Z")

</div>

`invokeLater` is a UI related function and only exists in the client. You can use it in script libraries but the function will only work if the invocation originates from the client/designer scope.

---

<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:** [January 10, 2020, 1:34pm UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207/5 "2020-01-10T13:34:39Z")

</div>

FWIW, I implemented an emulation of invokeLater for gateway scope in my [later.py](https://www.automation-pros.com/ignition/later.py) helper script, mentioned here:

> [@Reset Tag Value after a Number of Seconds](http://forum.inductiveautomation.com/t/reset-tag-value-after-a-number-of-seconds/17098/9):
>
> It’s unfortunate that there’s no alternative to invokeLater in gateway scope. I may just have to add something to [later.py](https://www.automation-pros.com/ignition/later.py) to address this.

and here:

> [@Ignition 8 invokeLater function doesn't seem to exist](http://forum.inductiveautomation.com/t/ignition-8-invokelater-function-doesnt-seem-to-exist/25174/4):
>
> I’ve updated [later.py](https://www.automation-pros.com/ignition/later.py) for Ignition v8. It includes an implementation of invokeLater usable in gateway scope.

Note that it uses officially unsupported methods to obtain the appropriate context.

The official method of obtaining delays in gateway scope (per IA support) is to use a sleep in an asynchronous thread. That's just ugly. Almost unforgivable. /:

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 10, 2020, 1:54pm UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207/6 "2020-01-10T13:54:41Z")

</div>

If you are trying to use it for gateway, then use **invokeAsynchronous**

---

<div class="post-metadata">

**Author:** ![rajesh.dayala](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@rajesh.dayala](https://forum.inductiveautomation.com/u/rajesh.dayala)\
**Post date:** [January 10, 2020, 2:13pm UTC](https://forum.inductiveautomation.com/t/invokelater-function-problem-in-script-library/31207/7 "2020-01-10T14:13:04Z")

</div>

Thanks every One for your suggestions 😊, They were really helpful for resolving my problem that i was facing.
