Updated Project Library Scripts Not Reflecting in Gateway (Ignition 8.1.48)

Hi,

I am facing an issue in Ignition 8.1.48:

  • I have a Gateway Scripting Project RANTRA_NEW with multiple library packages (e.g., OEE_NEW).
  • Any updates or newly added functions in any library script work immediately in the Script Console.
  • However, Gateway scripts (Tag Change Events, Timer Scripts, etc.) continue to use old cached versions of all library scripts.
  • Restarting the Gateway makes the updated code work.
  • We always used to save and publish (merge any new changes on the gateway into the open project).

Attempts / Observations:

  1. Standard imports like import OEE_NEW or from OEE_NEW import my_script in Gateway scripts fail with ImportError.
  2. Tried importlib.reload() on library modules — works in does not affect Gateway script and Script Console too.
  3. Confirmed module availability using system.util.getModules() — shows modules in Designer, but not the updated version package in Gateway.

Questions:

  1. Is there a supported way to dynamically reload updated project library scripts in Gateway scripts without restarting the Gateway?
  2. What is the recommended way to use updated library functions in Tag Events, Timer Scripts, and other Gateway-executed scripts?

Info:

  • Project: RANTRA_NEW
  • Library packages: multiple (OEE_NEW, etc.)
  • Ignition version: 8.1.48

Sometimes we experience this too, when updating code from the script library that is referenced from a component event.

In a production environment, restarting the server or gateway is not a viable option. How can we prevent or work around this issue without requiring a restart?

The script console runs in designer scope. The designer has access to both saved and unsaved resources.

This is likely the root cause of the issues you are seeing. Never import project library scripts. Only reference them by fully qualified names.

For instance this:

from OEE_NEW import my_script
my_script()

Should just be:

OEE_NEW.my_script()

NOTE: Folder names are also required in the path.

Assuming you haven't imported the Libraries anywhere, and you haven't leaked them anywhere by using them unsafely, then saving the project will cause the scripting engine to restart, which will reload the scripts.

Saving an inheritable project will cascade down, causing any projects which inherit from it, to also restart their scripting engines. This can cause missed events and other things where scripts can not run because the scripting engine is unavailable, so caution should, as always, be taken to avoid those types of issues in a production environment.

It should not be nessesary to restart the gateway. I on 8.1 since 8.1.5 and I have never had to restart my gateway in order to get changes in my project libraries to take effect, a project save is the only thing that has ever been requiered.

For Tag Events, it depends on which type you are asking about. For valueChange Tag Events (those that are on the tags themselves), the script must be located in the project which is set as the Gateway Scripting Project. For Gateway Tag Change events, then the scripts must be available to the project in which they are configured.

The same goes for Timer Events, the scripts must be available to the project in which they are configured.

"Other Gateway-executed scripts" is really too vauge to give a good answer to.

4 Likes