ImportError : No Module name factoryPMI

Hello There,

I see something strange happening.

I've one of the global script importing some libraries,

from java.lang import String
from java.util import Calendar
from java.awt import Color, Font
from java.util import TreeMap, HashMap
from com.inductiveautomation.factorypmi.application.components.chart import DataSetDescriptor
import com.inductiveautomation.ignition.common.Dataset as datasetObj 
from com.inductiveautomation.factorypmi.application.components.chart import NumberAxisConfig
from org.jfree.chart.annotations import XYTitleAnnotation
from org.jfree.chart.title import LegendTitle
from org.jfree.chart.block import BlockBorder
from org.jfree.ui import RectangleEdge, RectangleAnchor
from java.awt import BasicStroke,Font
from org.jfree.chart.renderer.xy import XYSplineRenderer

This works fine and does what I want but it breaks other script running from Gateway event and when I log it with logger, this is the error it prints :

Detail : Exception on Executing Main Script : Error loading module CycleTime: Traceback (most recent call last): File "<module:shared.mixing.Reports.CycleTime>", line 336, in <module> ImportError: No module named factorypmi on Line Number - 2784

Not sure why it would do that. Any idea ?

Thanks so much in advance

It breaks because you're trying to import classes that don't exist in the Gateway scope.

This script cannot be run in the Gateway, only the Designer or Vision Client.

In other words, separate the script into two or more, based on the scopes you need to call them from and the availability of the IA parts.

@Kevin.Herron , @pturmel - Thank you for your help. Just moved the script to client scope and worked fine.