# No module named gateway

**URL:** <https://forum.inductiveautomation.com/t/no-module-named-gateway/24005>\
**Category:** Ignition\
**Created:** [April 10, 2019, 6:09pm UTC](https://forum.inductiveautomation.com/t/no-module-named-gateway/24005 "2019-04-10T18:09:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Canuck](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@Canuck](https://forum.inductiveautomation.com/u/Canuck)\
**Post date:** [April 10, 2019, 6:09pm UTC](https://forum.inductiveautomation.com/t/no-module-named-gateway/24005/1 "2019-04-10T18:09:51Z")

</div>

I’m trying to call a global shared function containing calls to the api from the script console.  
I’ve included a screenshot to provide the context.

The function starts with:  
‘from com.inductiveautomation.ignition.gateway import SRContext’  
When calling the function in the script module, I get an error message that says ‘No module named gateway’  
By the way, I get the same error if I try the put the function code directly in the script module.

In contrast, I created a tag which calls this function and the function calls executes properly there.

What am I missing?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6fbeafcdb950471b8205b69bd3cf846d15b20687.png)

---

<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:** [April 10, 2019, 6:29pm UTC](https://forum.inductiveautomation.com/t/no-module-named-gateway/24005/2 "2019-04-10T18:29:23Z")

</div>

You can’t run this in the script console because it’s executing in the Designer in that case.

---

<div class="post-metadata">

**Author:** ![Canuck](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@Canuck](https://forum.inductiveautomation.com/u/Canuck)\
**Post date:** [April 10, 2019, 6:41pm UTC](https://forum.inductiveautomation.com/t/no-module-named-gateway/24005/3 "2019-04-10T18:41:51Z")

</div>

I see.  
So, how does one go about quickly/easily testing those kinds of functions?

---

<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:** [April 10, 2019, 6:58pm UTC](https://forum.inductiveautomation.com/t/no-module-named-gateway/24005/4 "2019-04-10T18:58:25Z")

</div>

A boolean memory tag and a tag change script seem okay to me.

---

<div class="post-metadata">

**Author:** ![Kurt.Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kurt.larson/32/6426_2.png) [@Kurt.Larson](https://forum.inductiveautomation.com/u/Kurt.Larson)\
**Post date:** [April 10, 2019, 7:06pm UTC](https://forum.inductiveautomation.com/t/no-module-named-gateway/24005/5 "2019-04-10T19:06:14Z")

</div>

You could also use sendRequest with a Gateway message handler that calls the shared scripts. Since you’re using a parameter, you could pass a payload within sendRequest to specify the datasink name.

In Gateway message handler: `shared.StoreAndForward.cachePending(payload["name"])`

In script console: `system.util.sendRequest("projectName", "messageHandlerName", {"name":"myDataSinkName"})`
