# Nested invokeAsynchronous and invokeLater

**URL:** <https://forum.inductiveautomation.com/t/nested-invokeasynchronous-and-invokelater/26006>\
**Category:** Ignition\
**Created:** [June 21, 2019, 10:08am UTC](https://forum.inductiveautomation.com/t/nested-invokeasynchronous-and-invokelater/26006 "2019-06-21T10:08:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 21, 2019, 11:07am UTC](https://forum.inductiveautomation.com/t/nested-invokeasynchronous-and-invokelater/26006/2 "2019-06-21T11:07:11Z")

</div>

You can nest as shown. Another possibility would be to use just one asynchronous task and using CompletableFutures to pause that background and retrieve information from the foreground. See this discussion involving my later.py script module:

> [@Update GUI via Asynchronous thread](http://forum.inductiveautomation.com/t/update-gui-via-asynchronous-thread/9666/11):
>
> OK. I’ve poked myself with the futures idea. Grab the latest version of [later.py](https://www.automation-pros.com/ignition/later.py), then try this: def asyncInvoked(): # do something in the background shared.later.callLater(system.gui.messageBox, "Please Press OK").get() # do something after OK is pressed system.util.invokeAsynchronous(asyncInvoked) Note the use of .get() to wait for system.gui.messageBox to complete. This updated later.py includes an emulation of invokeLater for gateway scope. Untested and unsupported! Edit: Realized…

---

_[View the full topic](https://forum.inductiveautomation.com/t/nested-invokeasynchronous-and-invokelater/26006)._
