# Load Jython Classes on Startup

**URL:** <https://forum.inductiveautomation.com/t/load-jython-classes-on-startup/63585>\
**Category:** Ignition\
**Created:** [August 29, 2022, 11:25pm UTC](https://forum.inductiveautomation.com/t/load-jython-classes-on-startup/63585 "2022-08-29T23:25:36Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [August 30, 2022, 6:34pm UTC](https://forum.inductiveautomation.com/t/load-jython-classes-on-startup/63585/5 "2022-08-30T18:34:05Z")

</div>

> [@Jonathan](#):
>
> It appears to me that the project library scripts do not load until a class is referenced in them.

Any named object, actually. And once-through is **intended behavior** , like import. Cross-thread dependencies are not supposed to impact this import mechanism ( ~~there's an import lock~~ ), but maybe IA has **introduced a bug here**.

Consider using a global lock object to ensure initialization doesn't happen in parallel (via `system.util.getGlobals()` or the similar `system.util.persistent()` from my LifeCycle module).

You may recall participating in this topic:

> [@\[IGN-5244\]Persist Python Class Object](https://forum.inductiveautomation.com/t/ign-5244-persist-python-class-object/30498):
>
> I am working in Perspective, but this probably applies to other modules as well. I have created user defined classes in the project scripts and I am instantiating them from a view in Perspective. Is there a place I can persist the instance of the object for use between events by the user? Right now I have it serializing to a property on the view, but when I want to work with the object again I have to de-serialize the object in order to work with it again. Having to write custom de-serialize me…

Edit: Bug found, work-around developed:

> [@Project Library Script Initialization Races](https://forum.inductiveautomation.com/t/project-library-script-initialization-races/98636):
>
> Are you annoyed by pseudo-random breakage in Ignition project library scripting? Odd top-level constants being garbled, or operations in the top level that have side effects running twice? Or more? Not happening much, but always around project edits, and sometimes even on gateway restart? Yeah, me too. frowning_face Poking around under the hood back in the spring, for a module development task, I ran across some problematic IA bytecode and pinged some people. But it went nowhere, as I co…

---

_[View the full topic](https://forum.inductiveautomation.com/t/load-jython-classes-on-startup/63585)._
