# Ignition fails to load a script file

**URL:** <https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [July 24, 2024, 4:39pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683 "2024-07-24T16:39:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShaneH](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@ShaneH](https://forum.inductiveautomation.com/u/ShaneH)\
**Post date:** [July 24, 2024, 4:39pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683/1 "2024-07-24T16:39:19Z")

</div>

Ignition Perspective 8.1.42

At random, infrequent times, I get errors referencing script files. I've included a screen shot of an example for "shared.Tables" -- it occurs with other scripts.

It seems to happen most often with "valueChanged" (on change) and "onStartup" events.

I tried adding an explicit 'import' and the error is "ImportError: No module named shared"

Without the import, the error is "No global named shared"

Error Log:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dc693a8ceabd2c0032ca17c3dc66fc2379ceb839.png)

On change script:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/6/c6c2cefc7071c60c784cd1fff0d728421d685cef.png)

---

<div class="post-metadata">

**Author:** ![Samuel\_Sueur](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Samuel\_Sueur](https://forum.inductiveautomation.com/u/Samuel_Sueur)\
**Post date:** [July 24, 2024, 4:55pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683/2 "2024-07-24T16:55:10Z")

</div>

If this is a valueChanged event on a tag, make sure that the project containing the "shared" scripting library is also defined as the gateway project library where the tag is defined.

This is my only suggestion, I'll let the experts chime in in case this does not solve your issue.

EDIT: I'm dumb, this is obviously a property change script, my bad but might be worth trying?...

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [July 24, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683/3 "2024-07-24T17:01:14Z")

</div>

You shouldn't need to import shared. Remove that import and see if that helps.

---

<div class="post-metadata">

**Author:** ![ShaneH](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@ShaneH](https://forum.inductiveautomation.com/u/ShaneH)\
**Post date:** [July 24, 2024, 8:58pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683/4 "2024-07-24T20:58:49Z")

</div>

As I tried to make clear in my original post, I've tried it both ways.

With the import, the error that pops up is "ImportError: No module named shared".

Without the import, the error that pops up randomly is "No global named shared".

To be clear, 99% of the time I don't see any errors from the prop on change script. Just trying to figure out why I sometimes get this one.

---

<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:** [July 24, 2024, 9:22pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683/5 "2024-07-24T21:22:30Z")

</div>

The most likely explanation is just "it's a bug". An intermittent problem with otherwise identical code sounds like a race condition in the script initialization process. It would be interesting if you could correlate "times it didn't work" with "times changes were made to the project or project(s) in the Designer and saved". I have a suspicion they would be related to each other.

I would encourage you to contact Support - they may or may not have a _fix_, but if nothing else can collect more detailed information from you and help get this issue in front of the right development team to take a detailed look.

---

<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:** [July 24, 2024, 9:42pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683/6 "2024-07-24T21:42:53Z")

</div>

> [@paul-griffith](#):
>
> like a race condition in the script initialization process

Hmmm. Why does that sound familiar... 😉

---

<div class="post-metadata">

**Author:** ![ShaneH](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@ShaneH](https://forum.inductiveautomation.com/u/ShaneH)\
**Post date:** [August 7, 2024, 12:10pm UTC](https://forum.inductiveautomation.com/t/ignition-fails-to-load-a-script-file/93683/7 "2024-08-07T12:10:00Z")

</div>

Paul-

Your suspicion is probably correct. There does seem to be a correlation between project saves/updates and when the error occurs.

Thanks for the tip.

-Shane
