# ImportError : No Module name factoryPMI

**URL:** <https://forum.inductiveautomation.com/t/importerror-no-module-name-factorypmi/71491>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [March 23, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/importerror-no-module-name-factorypmi/71491 "2023-03-23T13:26:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [March 23, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/importerror-no-module-name-factorypmi/71491/1 "2023-03-23T13:26:18Z")

</div>

Hello There,

I see something strange happening.

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

```auto
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 :

```auto
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

---

<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 23, 2023, 1:35pm UTC](https://forum.inductiveautomation.com/t/importerror-no-module-name-factorypmi/71491/2 "2023-03-23T13:35:04Z")

</div>

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.

---

<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:** [March 23, 2023, 1:38pm UTC](https://forum.inductiveautomation.com/t/importerror-no-module-name-factorypmi/71491/3 "2023-03-23T13:38:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [March 23, 2023, 6:35pm UTC](https://forum.inductiveautomation.com/t/importerror-no-module-name-factorypmi/71491/4 "2023-03-23T18:35:31Z")

</div>

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