# \[Question\]How to use Project Scripts

**URL:** <https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354>\
**Category:** Ignition Early Access\
**Created:** [March 14, 2019, 7:23pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354 "2019-03-14T19:23:36Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhottell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jhottell/32/6472_2.png) [@jhottell](https://forum.inductiveautomation.com/u/jhottell)\
**Post date:** [March 14, 2019, 7:23pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/1 "2019-03-14T19:23:36Z")

</div>

Vision issue here. I have imported a large project and there are things complaining about “NameError: global name ‘project’ is not defined”

Essentially calling project scripts with “project.myFuncs.callMe(‘Hello World’)” is not working. I just did the tutorial found in the help and it works in **7.9.9** but not in **8.0.0-beta0 (b2019031402)**  
[https://docs.inductiveautomation.com/display/DOC80/Project+and+Shared+Scripts](https://docs.inductiveautomation.com/display/DOC80/Project+and+Shared+Scripts)

I apologize in advance if this is in the forum, I did search around for a while.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 14, 2019, 7:25pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/2 "2019-03-14T19:25:46Z")

</div>

Did you change anything or just an unmodified backup restore?

Can you upload/send your backup to us?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 14, 2019, 8:00pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/3 "2019-03-14T20:00:34Z")

</div>

You no longer reference “project” scripts with `project.package_name.method_name` any longer, unless your “Scripting/Project Library/\<package\_name\>” is actually “Scripting/Project Library/project”  
In the following screenshot I would reference THIS project’s scripts with `project.Security.<method_name>`  
 ![56%20PM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/71b07ebefbe03e7b5917f618a7bbe860559eb958.png)  
And I would access shared scripts (which are located in the parent project) with `shared.<package_name>.<method_name>`

**Notes:**

- Inherited scripts are always under “shared” regardless of the parent project’s name.
- “project” only happens to be what I’ve named the package - you can name it anything else (within reason) and reference it with `<high_level_package_name>.<low-level_package_name>.<method_name>(**args)`

---

<div class="post-metadata">

**Author:** ![jhottell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jhottell/32/6472_2.png) [@jhottell](https://forum.inductiveautomation.com/u/jhottell)\
**Post date:** [March 14, 2019, 8:05pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/4 "2019-03-14T20:05:01Z")

</div>

OK so simply put: remove the “project.” and it works! Or… move the scripts into a folder called “project”  
Thanks.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 14, 2019, 8:06pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/5 "2019-03-14T20:06:05Z")

</div>

> [@jhottell](#):
>
> OK so simply put: remove the “project.” and it works!

Yes, but...

Was this an unmodified upgrade that just stopped working or were you trying to reference project scripts that don't exist in a new project?

---

<div class="post-metadata">

**Author:** ![jhottell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jhottell/32/6472_2.png) [@jhottell](https://forum.inductiveautomation.com/u/jhottell)\
**Post date:** [March 14, 2019, 8:07pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/6 "2019-03-14T20:07:15Z")

</div>

It was a big existing project, legacy screens that couldn’t find the scripts any more. Restored by import export not a gateway backup upgrade.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 14, 2019, 8:09pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/7 "2019-03-14T20:09:03Z")

</div>

It sounds like these are new scripts.

> [@jhottell](#):
>
> I just did the tutorial found in the help and it works in **7.9.9** but not in **8.0.0-beta0**

---

<div class="post-metadata">

**Author:** ![jhottell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jhottell/32/6472_2.png) [@jhottell](https://forum.inductiveautomation.com/u/jhottell)\
**Post date:** [March 14, 2019, 8:12pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/8 "2019-03-14T20:12:31Z")

</div>

Well its both, lots of screens exported from 7.9.9 had the error then I went to v8.0 help and it instructed me to use “project.script.sub” so updating the documentation is really the answer. (Yes i understand the documentation is underway)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 14, 2019, 10:40pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/9 "2019-03-14T22:40:11Z")

</div>

I’m working on replicating this, but I need some clarifications:  
Did you **import** a 7.9.9 project, OR did you **upgrade** an already deployed 7.9.9 project, OR did you **restore** a 7.9.9 Gateway backup?

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [March 16, 2019, 2:18am UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/10 "2019-03-16T02:18:24Z")

</div>

jhottell - cmallonee is asking these questions because doing an update of an existing system with the installer or restoring a .gwbk from a prior version into 8 is supposed to automatically put scripts in the right location so they don’t have any issues. In theory, if you do an upgrade, you shouldn’t need to change any of your scripts and everything should continue to work as it did before.

---

<div class="post-metadata">

**Author:** ![jhottell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jhottell/32/6472_2.png) [@jhottell](https://forum.inductiveautomation.com/u/jhottell)\
**Post date:** [March 16, 2019, 3:04am UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/11 "2019-03-16T03:04:07Z")

</div>

OK sorry for the delay.  
It is NOT from gateway or project backup. Its from FIle --\> Import and Export.  
I just tried it again and they all imported into the same space which may be intentional?

There are some other reasons why restoring from a gateway backup doesn’t work on my system so I can’t test how that would work (UDT’s referencing themselves as a parent type) but that is another story.

Thanks

---

<div class="post-metadata">

**Author:** ![LandrethEdward](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@LandrethEdward](https://forum.inductiveautomation.com/u/LandrethEdward)\
**Post date:** [March 4, 2020, 5:05pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/12 "2020-03-04T17:05:03Z")

</div>

Hi. We have recently upgraded a server from 7.9 to 8 and are seeing a similar issue with referencing the inherited shared scripts. We have several tag event scripts that are calling out a legacy script with the syntax listed above. In one example of ours looks like “shared.OEE.logdowntime()”, but we’re still seeing the error that the global name ‘shared’ is not defined.

The project “global” has the scripts from the upgrade and is inheritable and set as the parent project to the project using these tags, but I’m not certain tag event scripts are tied to any project settings. Please let me know if there is a different syntax or solution for letting tags reference the new project and legacy scripts. Thank you.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 4, 2020, 5:07pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/13 "2020-03-04T17:07:19Z")

</div>

Can you check that the “Gateway Scripting Project” setting is pointing at the “global” project?

[https://docs.inductiveautomation.com/display/DOC80/Gateway+Settings](https://docs.inductiveautomation.com/display/DOC80/Gateway+Settings)

---

<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:** [March 4, 2020, 5:12pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/14 "2020-03-04T17:12:17Z")

</div>

Also, have you restarted the gateway since restoring? There’s an issue (fixed in 8.0.10) with the initial gateway launch after restoring from 7.9 not correctly ‘setting’ the gateway scripting project (although it does update the setting, so subsequent restarts are fine).

---

<div class="post-metadata">

**Author:** ![LandrethEdward](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@LandrethEdward](https://forum.inductiveautomation.com/u/LandrethEdward)\
**Post date:** [March 4, 2020, 5:15pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/15 "2020-03-04T17:15:11Z")

</div>

Hi yes I saw this setting in the gateway and it was correct. I selected save changes and immediately saw some of our global scripts store data into SQL so it seems a refresh was needed. We also had a refresh issue with setting our default tag provider where it was set correctly and we happened to press the refresh button and saw the issues go away.

I have not restarted the server since installing so I will do so now thank you! I will reply here if we see the issue return otherwise I think it just needs to refresh it’s settings after they’ve been updated thanks for your help!

---

<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:** [March 4, 2020, 5:47pm UTC](https://forum.inductiveautomation.com/t/question-how-to-use-project-scripts/23354/16 "2020-03-04T17:47:50Z")

</div>

A post was split to a new topic: [Problems restarting gateway](https://forum.inductiveautomation.com/t/problems-restarting-gateway/32807)
