# Calling a script function from the Bacnet driver from another module

**URL:** <https://forum.inductiveautomation.com/t/calling-a-script-function-from-the-bacnet-driver-from-another-module/89029>\
**Category:** Module Development\
**Tags:** perspective\
**Created:** [April 18, 2024, 9:55am UTC](https://forum.inductiveautomation.com/t/calling-a-script-function-from-the-bacnet-driver-from-another-module/89029 "2024-04-18T09:55:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![e.sagnelonge](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@e.sagnelonge](https://forum.inductiveautomation.com/u/e.sagnelonge)\
**Post date:** [April 18, 2024, 9:55am UTC](https://forum.inductiveautomation.com/t/calling-a-script-function-from-the-bacnet-driver-from-another-module/89029/1 "2024-04-18T09:55:37Z")

</div>

Hello,

I am currently developing a perspective component for manipulating Bacnet schedules.  
I would like to call the **system.bacnet.readRaw** function from the **Bacnet Driver module** directly within the Java code of my module to simplify its usage.

The RPC approach is not feasible because there are no instances of it instantiated in the Bacnet module.  
The Script Manager approach, using runFunction, seems to encounter some difficulties during the conversion of Bacnet types.

```auto
    public static Object readRaw (GatewayContext gatewayContext, String deviceName, ObjectType objectType, Integer objectId, PropertyIdentifier propertyId, Integer propertyArrayIndex) throws Exception{
        PyObject systemModule = gatewayContext.getScriptManager().createLocalsMap(). __finditem__ ("system");
        PyObject bacnetModule = systemModule. __finditem__ ("bacnet");
        PyObject readRawFunction = bacnetModule. __finditem__ ("readRaw");

        PyObject[] arguments = new PyObject[] { new PyString(deviceName), Py.java2py(objectType), new PyInteger(objectId), Py.java2py(propertyId), new PyInteger(propertyArrayIndex) };

        return gatewayContext.getScriptManager().runFunction(readRawFunction, arguments);
    }

```

JythonExecException: TypeError: readRaw(): argument objectType: expected ObjectType instance, got PyObjectDerived

Does anyone know of a solution or have an idea?
