# Module added via addScriptModule not visible in Jython

**URL:** <https://forum.inductiveautomation.com/t/module-added-via-addscriptmodule-not-visible-in-jython/12157>\
**Category:** Module Development\
**Created:** [September 23, 2016, 1:09pm UTC](https://forum.inductiveautomation.com/t/module-added-via-addscriptmodule-not-visible-in-jython/12157 "2016-09-23T13:09:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xasga](https://avatars.discourse-cdn.com/v4/letter/x/838e76/32.png) [@xasga](https://forum.inductiveautomation.com/u/xasga)\
**Post date:** [September 23, 2016, 1:09pm UTC](https://forum.inductiveautomation.com/t/module-added-via-addscriptmodule-not-visible-in-jython/12157/1 "2016-09-23T13:09:20Z")

</div>

I register a script module specifying location “xasClassA”.  
The module loads without incident at restart of the gateway.  
In the Designer scripting console, this line:  
import xasClassA  
results in this error message:  
Import Error: No module named xasClassA

This is the code in the module:  
@Override  
public void initializeScriptManager(ScriptManager oScriptManager)  
{  
oScriptManager.addScriptModule(“xasClassA”, new MyClassA());  
}

---

<div class="post-metadata">

**Author:** ![xasga](https://avatars.discourse-cdn.com/v4/letter/x/838e76/32.png) [@xasga](https://forum.inductiveautomation.com/u/xasga)\
**Post date:** [September 23, 2016, 4:09pm UTC](https://forum.inductiveautomation.com/t/module-added-via-addscriptmodule-not-visible-in-jython/12157/2 "2016-09-23T16:09:13Z")

</div>

This is partially solved. I’ll show the partial solution here and open a new topic for the remaining issue.

The Script Console in the Designer executes the script in the Designer scope.  
I added the script module in the gateway hook, because it will be a gateway script.  
I was attempting to use the script module in Script Console.  
Adding the script module in the designer hook class makes the class visible in Script Console.

I was only able to make this work if the namespace is a subset of system.  
oScriptManager.addScriptModule(“system.xasClassA”, MyClassA);

Note to technical writer:  
It took me quite a while to realize that the class name in the module code is not visible at all in the script environment. The namespace/location parameter is effectively the class name.

I was thinking that one location could hold multiple classes, addressed as: location.class. Not true.

Note to gateway system programmer:  
Seems odd that when a second class is added to an existing namespace the script manager would merge the classes, instead of writing the second one over the first, or ignoring the second, with a warning.
