# Testing Scripts for Gateway Scope

**URL:** <https://forum.inductiveautomation.com/t/testing-scripts-for-gateway-scope/117577>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [October 22, 2026, 3:30pm UTC](https://forum.inductiveautomation.com/t/testing-scripts-for-gateway-scope/117577 "2026-10-22T15:30:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [October 22, 2026, 3:30pm UTC](https://forum.inductiveautomation.com/t/testing-scripts-for-gateway-scope/117577/1 "2026-10-22T15:30:44Z")

</div>

What's the best way to quickly develop and test gateway scoped scripts? The script console is nice but is only client scope, so if I need to test something like `system.file.fileExists()` I'm not quite sure the best way to actually test it and see the output like I would in the script console?

---

<div class="post-metadata">

**Author:** ![vtran](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vtran](https://forum.inductiveautomation.com/u/vtran)\
**Post date:** [October 22, 2026, 3:39pm UTC](https://forum.inductiveautomation.com/t/testing-scripts-for-gateway-scope/117577/2 "2026-10-22T15:39:24Z")

</div>

The most straight forward way that worked for me before is to just wire them in a Perspective screen and use a logger or `system.perspective.print` to debug.

Alternatively, I think Phil's toolkit module has a decorator `@system.util.runInGateway` that you can wrap your script.

---

<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 22, 2026, 3:41pm UTC](https://forum.inductiveautomation.com/t/testing-scripts-for-gateway-scope/117577/3 "2026-10-22T15:41:43Z")

</div>

> [@vtran](#):
>
> Phil's toolkit module has a decorator

This. Put your code to be tested in a project library function, with the decorator, and save. You can call from the script console and it will run in the gateway.
