# Gateway script access to calling container's properties

**URL:** <https://forum.inductiveautomation.com/t/gateway-script-access-to-calling-containers-properties/19543>\
**Category:** Ignition\
**Created:** [September 5, 2018, 1:15pm UTC](https://forum.inductiveautomation.com/t/gateway-script-access-to-calling-containers-properties/19543 "2018-09-05T13:15:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![don.overturf](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@don.overturf](https://forum.inductiveautomation.com/u/don.overturf)\
**Post date:** [September 5, 2018, 1:15pm UTC](https://forum.inductiveautomation.com/t/gateway-script-access-to-calling-containers-properties/19543/1 "2018-09-05T13:15:44Z")

</div>

I am working on a script will be shared among many clients as well as being used multiple times within the project. The script takes the values of various dropdowns, textboxes, checkboxes, etc. and generates an xml file to send to an industrial printer. Is there a way to reference the calling container’s properties in the gateway script?  
For example, I currently use the syntax below to access the component’s property from another component’s mouseReleased event script.  
**name = event.source.parent.getComponent(‘Dropdown’).selectedStringValue**  
I then pass the variable ‘name’ to the global script:  
xml = shared.PS.printControlToXML(name, etc…)

Is I possible to do something like this in a gateway (or project) script?  
_name = reference\_from\_calling\_container.getComponent(‘Dropdown’).selectedStringValue_

If this is possible, can somebody help with an example of the proper syntax?

TIA

Don

---

<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:** [September 5, 2018, 1:51pm UTC](https://forum.inductiveautomation.com/t/gateway-script-access-to-calling-containers-properties/19543/2 "2018-09-05T13:51:34Z")

</div>

You can’t even call gateway scripts from clients, so, no. And even within the client or designer, no. Not automatically. If you need to pass a container to a script in a module, make a function argument for it. From an event, you’d pass event.source.parent there.  
Depending on whether you really need gateway scope, you may be able to achieve what you want with system.util.sendMessage or .sendRequest, but gui objects cannot be placed into the message payload – they are confined to their origin scope.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 5, 2018, 3:46pm UTC](https://forum.inductiveautomation.com/t/gateway-script-access-to-calling-containers-properties/19543/3 "2018-09-05T15:46:48Z")

</div>

It also sounds like you’re potentially over complicating things. If you just want to write your code once, and use it in all your clients, then use the `shared` scripts folder - as long as you’re _calling_ those functions from the client scope, you’ll be able to use whatever GUI related code you need. If you do truly need to then hand it off to the gateway scope to actually perform a print, then you can have all of that code in a gateway message handler.

---

<div class="post-metadata">

**Author:** ![don.overturf](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@don.overturf](https://forum.inductiveautomation.com/u/don.overturf)\
**Post date:** [September 5, 2018, 6:48pm UTC](https://forum.inductiveautomation.com/t/gateway-script-access-to-calling-containers-properties/19543/4 "2018-09-05T18:48:12Z")

</div>

Update - - -  
My issue has been resolved.😤  
In order to access the GUI properties from the shared script, it is necessary to pass the calling event to the shared script. The calling event (in my case a button press) is:

> xml = shared.PS.PC\_ToXML(event)

The shared script declaration is:

> def PC\_ToXML(event):

Accessing values from the GUI components within the script:

> name = event.source.parent.getComponent('Dropdown').selectedStringValue

Thanks for your replies
