# Perspective, time.sleep vs later.py

**URL:** <https://forum.inductiveautomation.com/t/perspective-time-sleep-vs-later-py/39955>\
**Category:** Ignition\
**Created:** [October 23, 2020, 12:29pm UTC](https://forum.inductiveautomation.com/t/perspective-time-sleep-vs-later-py/39955 "2020-10-23T12:29:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![allnet](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@allnet](https://forum.inductiveautomation.com/u/allnet)\
**Post date:** [October 23, 2020, 12:29pm UTC](https://forum.inductiveautomation.com/t/perspective-time-sleep-vs-later-py/39955/1 "2020-10-23T12:29:35Z")

</div>

Hi all,

So what would be better, time.sleep or later.py, on Perspective View. ( 8.0.13 and after)  
a. for 1-3 seconds  
b. for longer period, minutes, days etc

Thanks for your insight.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 23, 2020, 2:59pm UTC](https://forum.inductiveautomation.com/t/perspective-time-sleep-vs-later-py/39955/2 "2020-10-23T14:59:13Z")

</div>

`time.sleep` should be avoided in basically every scenario - the only exception I would _maybe_ give is a dedicated thread spawned by `invokeAsynchronous`. `later.py` technically hooks into an internal class, but the signature of that class is pretty unlikely to change, and, crucially, it _does not_ require a thread to be kept sleeping.

---

<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:** [October 23, 2020, 3:01pm UTC](https://forum.inductiveautomation.com/t/perspective-time-sleep-vs-later-py/39955/3 "2020-10-23T15:01:48Z")

</div>

I’m naturally biased, as the author of `later.py`. But see my rants on people using sleep():

[http://forum.inductiveautomation.com/search?q=sleep%20%40pturmel](http://forum.inductiveautomation.com/search?q=sleep%20%40pturmel)

---

<div class="post-metadata">

**Author:** ![allnet](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@allnet](https://forum.inductiveautomation.com/u/allnet)\
**Post date:** [October 23, 2020, 5:28pm UTC](https://forum.inductiveautomation.com/t/perspective-time-sleep-vs-later-py/39955/4 "2020-10-23T17:28:35Z")

</div>

So in Perspective no invokeLater, noTimer, only time.sleep which should be avoided.

For the moment all we can say is Long Live Phil. 🙂

---

<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:** [October 23, 2020, 5:46pm UTC](https://forum.inductiveautomation.com/t/perspective-time-sleep-vs-later-py/39955/5 "2020-10-23T17:46:52Z")

</div>

In an event-driven environment, I see use of sleep() as an indication that there’s a state machine that needs to be written, with regular timer calls to step it along.
