# Gateway timer script - calling a function within a function - global not defined error

**URL:** <https://forum.inductiveautomation.com/t/gateway-timer-script-calling-a-function-within-a-function-global-not-defined-error/39313>\
**Category:** Ignition\
**Created:** [October 2, 2020, 3:50pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-script-calling-a-function-within-a-function-global-not-defined-error/39313 "2020-10-02T15:50:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 2, 2020, 3:58pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-script-calling-a-function-within-a-function-global-not-defined-error/39313/2 "2020-10-02T15:58:08Z")

</div>

Gateway level, project-scoped (gateway timer, tag change etc) scripts, for complicated legacy reasons, follow legacy scoping rules.

Generally speaking, the easiest, most maintainable thing to do is _immediately_ bail out of your gateway timer script to a function defined in a real project script, and have all of your logic there. Besides modern scoping, you also get the benefit of true diffing of project changes if it’s in a project script.

---

_[View the full topic](https://forum.inductiveautomation.com/t/gateway-timer-script-calling-a-function-within-a-function-global-not-defined-error/39313)._
