# Python module not recompiled when imported in another script

**URL:** <https://forum.inductiveautomation.com/t/python-module-not-recompiled-when-imported-in-another-script/16086>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [November 22, 2017, 12:24am UTC](https://forum.inductiveautomation.com/t/python-module-not-recompiled-when-imported-in-another-script/16086 "2017-11-22T00:24:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill.liu](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bill.liu](https://forum.inductiveautomation.com/u/bill.liu)\
**Post date:** [November 22, 2017, 12:24am UTC](https://forum.inductiveautomation.com/t/python-module-not-recompiled-when-imported-in-another-script/16086/1 "2017-11-22T00:24:05Z")

</div>

I have 2 scripts in the script library [project]. The second script imports the first with the following line.

```auto
from project.myFolder.myFirstScript import myClass

```

A function in the second script is called in the designer. If I make a change to myClass, commit the change, then save the project. The function in the second script still calls the old definition of myClass. It only updates the definition of myClass once I re-open the project.

Is this expected behaviour? I am using Ignition 7.9.2

---

<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 22, 2017, 1:48pm UTC](https://forum.inductiveautomation.com/t/python-module-not-recompiled-when-imported-in-another-script/16086/2 "2017-11-22T13:48:43Z")

</div>

It’s expected behavior. Script modules are effectively executed just once, the first time they are imported. Editing a script forces a reload (re-run) of that script. Your second script, unedited, runs the first time it is referenced, and it imports from your first script at that time. You need a change to the second script to trigger its reload after changing the first script.

---

<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 22, 2017, 1:49pm UTC](https://forum.inductiveautomation.com/t/python-module-not-recompiled-when-imported-in-another-script/16086/3 "2017-11-22T13:49:51Z")

</div>

The workaround is to not import the class in the second script, but to always reference it by its fully-qualified name.

---

<div class="post-metadata">

**Author:** ![bill.liu](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bill.liu](https://forum.inductiveautomation.com/u/bill.liu)\
**Post date:** [November 22, 2017, 9:14pm UTC](https://forum.inductiveautomation.com/t/python-module-not-recompiled-when-imported-in-another-script/16086/4 "2017-11-22T21:14:34Z")

</div>

Thank you Phil. The issue is solved when I reference the class using its fully-qualified name.
