# RPCHandler for multiple script modules

**URL:** <https://forum.inductiveautomation.com/t/rpchandler-for-multiple-script-modules/95759>\
**Category:** Module Development\
**Created:** [September 9, 2024, 9:58pm UTC](https://forum.inductiveautomation.com/t/rpchandler-for-multiple-script-modules/95759 "2024-09-09T21:58:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronrai24](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aaronrai24/32/87248_2.png) [@aaronrai24](https://forum.inductiveautomation.com/u/aaronrai24)\
**Post date:** [September 9, 2024, 9:58pm UTC](https://forum.inductiveautomation.com/t/rpchandler-for-multiple-script-modules/95759/1 "2024-09-09T21:58:42Z")

</div>

I've been following the simple scripting example to add a scripting function and was able to get a function added. My question is if you have multiple script modules how would you handle this in your RPC handler? If I wanted to add multiple script modules(ex system.example, system.example2) is defining a script module for each the "right" way to do it?

I assume based on the RPC call you make you'd want to send that scriptModule, but I am unsure on how to know which RPC call was made.Here's a simple definition in my client scope:

```java
    public ClientScriptModule() {
        rpc = ModuleRPCFactory.create(
            MODULEID,
            TimeBlackBox.class
        );
    }

    @Override
    protected long getCurrentTimeInMillisImpl() {
        return rpc.getCurrentTimeInMillis();
    }
}

```

my gateway hook currently just handles the one script module:

```java
    @Override
    public Object getRPCHandler(ClientReqSession session, String projectName) {
        return scriptModule;
    }

```

---

<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:** [September 9, 2024, 10:00pm UTC](https://forum.inductiveautomation.com/t/rpchandler-for-multiple-script-modules/95759/2 "2024-09-09T22:00:34Z")

</div>

This thread would probably be worth a read: [GatewayHook getRPCHandler Implementation - #3 by Kevin.Herron](https://forum.inductiveautomation.com/t/gatewayhook-getrpchandler-implementation/76980/3)
