# BundleUtil Abstract Extension Question

**URL:** <https://forum.inductiveautomation.com/t/bundleutil-abstract-extension-question/102624>\
**Category:** Module Development\
**Tags:** scripting\
**Created:** [February 20, 2025, 2:42pm UTC](https://forum.inductiveautomation.com/t/bundleutil-abstract-extension-question/102624 "2025-02-20T14:42:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [February 20, 2025, 2:42pm UTC](https://forum.inductiveautomation.com/t/bundleutil-abstract-extension-question/102624/1 "2025-02-20T14:42:57Z")

</div>

I have a feeling I know the answer, but I want to see what the experts think.

I have a lot of different Script Modules that get loaded into my module and I will have others to add.

Based on what I originally was learning how the scripting modules worked the SDK example included the BundleUtil section in the static{}

```Java
    static {
        BundleUtil.get().addBundle(
                myScriptModule.class.getSimpleName(),
                myScriptModule.class.getClassLoader(),
                myScriptModule.class.getName().replace('.', '/'));
    }

```

Initially I thought I would make an abstract class to house the Bundle section so I could not have to have the same code in every script module class.

> **abstract class**
>
> ```python
> public abstract class ScriptModule {
> 
> public ScriptModule () {
>         
> BundleUtil.get().addBundle(
> this.getClass().getSimpleName(),
> this.getClass().getClassLoader(),
> this.getClass().getName().replace('.', '/'));
> }
> 
> }
> 
> ```

I think this causes a problem since it would attempt to addBundle every time the class is created which makes sense based on it being in the constructor and not static.

Any ideas on making the code cleaner or should I just roll with the punches and just have the code be in each class?

I could also be going about this all wrong, so guidance is much appreciated.

---

<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:** [February 20, 2025, 3:22pm UTC](https://forum.inductiveautomation.com/t/bundleutil-abstract-extension-question/102624/2 "2025-02-20T15:22:58Z")

</div>

I create a single `Meta` class in my common-scope section of the module that loads a single bundle at hook setup/startup. The bundle carries _ **all** _ content for the property files doc provider. (Triggered by the appropriate annotations.)

---

<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 20, 2025, 4:30pm UTC](https://forum.inductiveautomation.com/t/bundleutil-abstract-extension-question/102624/3 "2025-02-20T16:30:36Z")

</div>

To Phil's point: Our examples (and internal code, for the most part) use a single properties file per script module, but there's nothing in the rules that says ~~a dog can't play basketball~~ you can't have multiple script modules in one properties file.

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [February 20, 2025, 6:58pm UTC](https://forum.inductiveautomation.com/t/bundleutil-abstract-extension-question/102624/4 "2025-02-20T18:58:51Z")

</div>

> [@pturmel](#):
>
> I create a single `Meta` class in my common-scope section of the module that loads a single bundle at hook setup/startup. The bundle carries _ **all** _ content for the property files doc provider. (Triggered by the appropriate annotations.)

Same here.
