# Script Library reloading and Project Inheritance

**URL:** <https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978>\
**Category:** Ignition\
**Created:** [November 5, 2025, 11:53pm UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978 "2025-11-05T23:53:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 5, 2025, 11:53pm UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/1 "2025-11-05T23:53:02Z")

</div>

I’m playing around with multi-project inheritance trees, for example where two runnable projects inherit from a single “Global” project, to see how project saves impact inherited script libraries, and i’m seeing odd results that I can’t explain.

I set something dumb up just for testing… I know you shouldn’t perform tag reads/writes within the root of a script library. However…

I have this script library defined in my Global project (which is **not** overridden in either of the two inheriting Main projects):

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

```python
tagPath = '[default]Testing/Test 2'
oldVal = system.tag.readBlocking(tagPath)[0].value
r = system.tag.writeBlocking(tagPath, oldVal + 1)
system.util.getLogger('BOB').info('{} -> {}'.format(oldVal, r))

```

Every time the library reloads it should increment the Test 2 tag value by 1.

- If I save the Global project, it increments 1 (I kind of expected it to flakily increment 1 or 2 depending on the speed that each Main project reloads the script library…)
- If I save the “Main” project, it increments 1. Edit: If I set the GSP to the Global project, it doesn’t increment at all.
- If I save the “Main2” project, it doesn’t increment at all.

I’m just looking to understand what’s happening here. I would have expected saving Main2 would also increment the tag value by 1, but it’s not. And why does saving Global not write 1 or sometimes 2?

Projects defined:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/4/b41281f7479695d0bd0b1d416b36c200f07fc15c.png)

Edit:

Note: the Main project is the global scripting project (GSP).

It seems to have to do with the GSP, but I would have expected a change to an inherited script library would reload it in all inherting projects which would then run it and therefore write to the tag in all locations. I added a lock to get rid of the race condition where two threads could read the current tag value at the same time and hence increment by 1 always instead of 2:

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

---

<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:** [November 6, 2025, 12:23am UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/2 "2025-11-06T00:23:30Z")

</div>

First - is this 8.1 or 8.3?

Second - don't use tags as your counter object - too race-y. Just store an int in `globals` if you want an accurate count.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 6, 2025, 12:28am UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/3 "2025-11-06T00:28:48Z")

</div>

It’s 8.3. I tried using a global variable as well but had the same “issue”, but in that case it’s due to different scopes I think… it depends where you read the value of the global key from as to what value you’ll see.

---

<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:** [November 6, 2025, 12:30am UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/4 "2025-11-06T00:30:13Z")

</div>

Do keep in mind that each leaf project, and the GSP if not a leaf itself, will all have their own interpreters. Only `system.util.globals` is shared across the JVM.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 6, 2025, 12:34am UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/5 "2025-11-06T00:34:07Z")

</div>

Would this not fix the raceyness with tags?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/3/2380571d6d0bed57691a2fb4c4a3dd134dfc273a.png)

---

<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:** [November 6, 2025, 1:02am UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/6 "2025-11-06T01:02:58Z")

</div>

Yes, until some other programmer stomps on your too-common name. (One of the reasons `system.util.globalVarMap()` takes a namespace argument.)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 6, 2025, 1:10am UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/7 "2025-11-06T01:10:02Z")

</div>

> [@pturmel](#):
>
> stomps on your too-common name

Of course, but I point you back to here 😛

> [@nminchin](#):
>
> I set something dumb up just for testing… I know you shouldn’t perform tag reads/writes within the root of a script library. However…

---

<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:** [November 6, 2025, 1:11am UTC](https://forum.inductiveautomation.com/t/script-library-reloading-and-project-inheritance/111978/8 "2025-11-06T01:11:36Z")

</div>

Good thing you made it a screenshot, so desperate future visitors cannot copy/paste it... ☹
