# Get the current project name

**URL:** <https://forum.inductiveautomation.com/t/get-the-current-project-name/106727>\
**Category:** Module Development\
**Created:** [May 27, 2025, 2:35pm UTC](https://forum.inductiveautomation.com/t/get-the-current-project-name/106727 "2025-05-27T14:35:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehrdad\_Telli](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mehrdad_telli/32/77763_2.png) [@Mehrdad\_Telli](https://forum.inductiveautomation.com/u/Mehrdad_Telli)\
**Post date:** [May 27, 2025, 2:35pm UTC](https://forum.inductiveautomation.com/t/get-the-current-project-name/106727/1 "2025-05-27T14:35:02Z")

</div>

How do I get the current project name from GatewayHook?

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [May 27, 2025, 2:40pm UTC](https://forum.inductiveautomation.com/t/get-the-current-project-name/106727/2 "2025-05-27T14:40:31Z")

</div>

Can you tell us a little more about what you're trying to do? The gateway doesn't really have a "current project" -- that would be a concept more for the Designer or the Client scopes.

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Telli](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mehrdad_telli/32/77763_2.png) [@Mehrdad\_Telli](https://forum.inductiveautomation.com/u/Mehrdad_Telli)\
**Post date:** [May 27, 2025, 3:36pm UTC](https://forum.inductiveautomation.com/t/get-the-current-project-name/106727/3 "2025-05-27T15:36:22Z")

</div>

I have several functions that need to receive the name of the current project. Currently, I’ve set up the script module like this:

```python
    @Override
    public void initializeScriptManager(ScriptManager manager) {
        super.initializeScriptManager(manager);
        manager.addScriptModule("system.myFunc",new CommonScript(context));
    }

```

However, what I actually intend to do is pass the project name as well, like so:

```python
manager.addScriptModule("system.myFunc",new CommonScript(context, projectName));

```

To achieve this, I attempted to use `ModuleRPCFactory` inside the `DesignerHook`:

```python
@Override
    public void startup(DesignerContext context, LicenseState activationState) throws Exception {
        ModuleRPC rpc = ModuleRPCFactory.create(ModuleMeta.MODULE_ID, ModuleRPC.class);
        System.out.println("getProjectName:"+rpc.getProjectName(context.getProjectName()));
    }

```

Unfortunately, I wasn’t able to retrieve the project name on the `GatewayHook` side.  
What is the correct way to get the current project name and pass it to the relevant functions?

---

<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:** [May 27, 2025, 3:43pm UTC](https://forum.inductiveautomation.com/t/get-the-current-project-name/106727/4 "2025-05-27T15:43:33Z")

</div>

Don't do that. Use [ScriptContext](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.47/com/inductiveautomation/ignition/common/script/ScriptContext.html) within your implementation of each call.

---

<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:** [May 27, 2025, 3:52pm UTC](https://forum.inductiveautomation.com/t/get-the-current-project-name/106727/5 "2025-05-27T15:52:26Z")

</div>

Use `ScriptContext` (n.b. the API is completely different in 8.3) and consider also accepting a _trailing_ project name parameter in your scripting function implementations, so that your end users can override it or provide one if `ScriptContext` isn't working; for instance, there's an unfixable bug in all versions prior to 8.3 where 'stacking' script executions (e.g. a tag change script running a report that itself runs a script during data gathering) would fail in 'weird' ways.

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Telli](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mehrdad_telli/32/77763_2.png) [@Mehrdad\_Telli](https://forum.inductiveautomation.com/u/Mehrdad_Telli)\
**Post date:** [May 28, 2025, 5:15am UTC](https://forum.inductiveautomation.com/t/get-the-current-project-name/106727/6 "2025-05-28T05:15:54Z")

</div>

Thank you, it's done.🙂
