# Script that always works in the background

**URL:** <https://forum.inductiveautomation.com/t/script-that-always-works-in-the-background/105277>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 18, 2025, 8:37am UTC](https://forum.inductiveautomation.com/t/script-that-always-works-in-the-background/105277 "2025-04-18T08:37:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![g.ferrario](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@g.ferrario](https://forum.inductiveautomation.com/u/g.ferrario)\
**Post date:** [April 18, 2025, 8:37am UTC](https://forum.inductiveautomation.com/t/script-that-always-works-in-the-background/105277/1 "2025-04-18T08:37:16Z")

</div>

good morning everyone,  
I have a view that is a popup, my goal is to make it appear with data, the data arrives via restapi, what I would like to do is a script that polls every x seconds and executes a Get method, towards a rest api server, this server will return data (bool, string), one to make the popup visible (the boolean tag), and the other the message. but I can't find where and/or how it is possible to do it.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 18, 2025, 9:26am UTC](https://forum.inductiveautomation.com/t/script-that-always-works-in-the-background/105277/2 "2025-04-18T09:26:22Z")

</div>

- Create an expression binding on your component or on a custom property on your view.  
`now(5000) // executes every 5,000 ms.`
- Add a transform, select Script.
- Write your code in there.

This isn't a "Script that always works in the background". It's an expression that runs on an event - a time-based event in this case. When the script has finished executing it exits and releases system resources. Don't ever use a `while` and `sleep()` functions for this.

---

<div class="post-metadata">

**Author:** ![g.ferrario](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@g.ferrario](https://forum.inductiveautomation.com/u/g.ferrario)\
**Post date:** [April 18, 2025, 9:49am UTC](https://forum.inductiveautomation.com/t/script-that-always-works-in-the-background/105277/3 "2025-04-18T09:49:10Z")

</div>

> [@Transistor](#):
>
> as finished executing it exits and releases system resources. Don't ever use a `while` and `sleep()` functions for this.

Thank you.
