# How to get the ScriptManager inside Gateway Module Java

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-the-scriptmanager-inside-gateway-module-java/56137>\
**Category:** Module Development\
**Created:** [February 14, 2022, 10:07pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-scriptmanager-inside-gateway-module-java/56137 "2022-02-14T22:07:35Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [February 15, 2022, 5:47pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-scriptmanager-inside-gateway-module-java/56137/5 "2022-02-15T17:47:06Z")

</div>

I wouldn't try to hardcode a script name. That's an antipattern - what if you want to change the name of the script that's invoked; you need to install a new module to do so?  
Instead, I would look into the extension function mechanism. You can provide an extension function with your component, invoke it when necessary from your code, and allow the end user in the designer to author whatever code they feel like.

There's some discussion on a similar problem in this thread, including some of the code required to invoke an extension function in Perspective; I'm not sure if our example module provides any samples of that:

> [@Any way to write to a file on the gateway or to database from javascript?](https://forum.inductiveautomation.com/t/any-way-to-write-to-a-file-on-the-gateway-or-to-database-from-javascript/51442):
>
> I would like to write to the db and some files directly from out of my module in js. Any way to do this (without webdev module?) I usually use ajax or node.js to connect to a db. With node i can also write files… But im guessing i dont have any access to those… or idk how they are set up to the ignition server

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-get-the-scriptmanager-inside-gateway-module-java/56137)._
