# Python's Timer: from threading import Timer

**URL:** <https://forum.inductiveautomation.com/t/pythons-timer-from-threading-import-timer/64268>\
**Category:** Ignition\
**Tags:** perspective, scripting, ignition81\
**Created:** [September 20, 2022, 8:28am UTC](https://forum.inductiveautomation.com/t/pythons-timer-from-threading-import-timer/64268 "2022-09-20T08:28:56Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![tupanaster](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tupanaster](https://forum.inductiveautomation.com/u/tupanaster)\
**Post date:** [September 20, 2022, 11:59am UTC](https://forum.inductiveautomation.com/t/pythons-timer-from-threading-import-timer/64268/7 "2022-09-20T11:59:34Z")

</div>

> [@lrose](#):
>
> Are you testing this in the Designer or in a real Session?

I'm testing in the designer for now.

> [@lrose](#):
>
> `system.util.invokeLater()` has a delay parameter.

You are right but I avoided it when I read this post:

> [@AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'invokeLater'](https://forum.inductiveautomation.com/t/attributeerror-com-inductiveautomation-ignition-common-script-imm-object-has-no-attribute-invokelater/41151/4):
>
> @pturmel has a `later.py` implementation here on the forums that uses an (internal) class to allow for the ‘delayed execution’ functionality of `invokeLater` to work on the gateway.

Answering these questions:

> [@lrose](#):
>
> I think you’re headed down a perilous road here. How do you plan to manage the life cycle of these threads? I see no way to halt or interrupt the timer. What happens if the gateway service needs to be rebooted? Or the project is saved restarting scripting?

There is no way to control them according to my research. If the gateway is rebooted or the scripts are restarted I will lose that execution.

I could use a Gateway Timer to check every XX time or Life Cycle Module. A Timer wouldn't execute in the exact moment and pturmel's module is new to me.

---

_[View the full topic](https://forum.inductiveautomation.com/t/pythons-timer-from-threading-import-timer/64268)._
