# \[Vision\] Using methods defined in project library on Gateway events

**URL:** <https://forum.inductiveautomation.com/t/vision-using-methods-defined-in-project-library-on-gateway-events/74915>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [June 12, 2023, 5:45pm UTC](https://forum.inductiveautomation.com/t/vision-using-methods-defined-in-project-library-on-gateway-events/74915 "2023-06-12T17:45:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fbrinneman](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbrinneman](https://forum.inductiveautomation.com/u/fbrinneman)\
**Post date:** [June 12, 2023, 5:45pm UTC](https://forum.inductiveautomation.com/t/vision-using-methods-defined-in-project-library-on-gateway-events/74915/1 "2023-06-12T17:45:02Z")

</div>

Hi everyone,

I have multiple scheduled Gateway events using functions from a script in the Project Library tree.

In the Gateway scheduled event, I'm importing the script as:

_ **import packageName.scriptName** _

And below, I use the function directly from the module imported:

**my\_function(param1, param2, param3)**

After the script runs, nothing happens, and I get this message in the schedule monitoring tab under "Gateway Scripts."

_Traceback (most recent call last):_

- File "", line 6, in onScheduledEvent\*  
_NameError: global name 'averagesCalculation' is not defined_

The same code works fine when I run it directly in the script console.

How can I access modules created in Project Library from the Gateway? Is this possible?

---

<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:** [June 12, 2023, 5:50pm UTC](https://forum.inductiveautomation.com/t/vision-using-methods-defined-in-project-library-on-gateway-events/74915/2 "2023-06-12T17:50:57Z")

</div>

Don't import library scripts in your project (or anywhere else). Ignition will do that for you. Just call the functions they contain, fully qualified.

The library script must be in the same project as the gateway event, or be in an inherited project.

{ The Vision tag doesn't apply to gateway scope issues, fwiw. }

---

<div class="post-metadata">

**Author:** ![fbrinneman](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbrinneman](https://forum.inductiveautomation.com/u/fbrinneman)\
**Post date:** [June 12, 2023, 8:06pm UTC](https://forum.inductiveautomation.com/t/vision-using-methods-defined-in-project-library-on-gateway-events/74915/3 "2023-06-12T20:06:16Z")

</div>

Yes, that solved the issue. Thank you again!
