# Gateway Tag Change Script Can't Read Relative Tag Path Value?

**URL:** <https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [November 20, 2024, 4:05pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876 "2024-11-20T16:05:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben522326](https://avatars.discourse-cdn.com/v4/letter/b/b4bc9f/32.png) [@Ben522326](https://forum.inductiveautomation.com/u/Ben522326)\
**Post date:** [November 20, 2024, 4:05pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876/1 "2024-11-20T16:05:42Z")

</div>

I'm creating a gateway tag change script that needs to read other tag values in the same folder as the tag that the script is pointed to. I noticed that using a relative tag path doesn't work in the gateway tag change script, but it does in a tag value changed script.

Tag Value Changed Script:

```python
relativePathTagID = system.tag.readBlocking("[.]Tag ID")[0].value
absolutePathTagID = system.tag.readBlocking("[default]Test Tags/Tag ID")[0].value
	
logger = system.util.getLogger("TagChangeScript")
logger.info("Relative Tag ID value: " + str(relativePathTagID))
logger.info("Absolute Tag ID value: "+ str(absolutePathTagID))

```

Gateway Tag Change Script (tag path pointed to same tag using the tag value changed script):

```python
relativePathTagID = system.tag.readBlocking("[.]Tag ID")[0].value
absolutePathTagID = system.tag.readBlocking("[default]Test Tags/Tag ID")[0].value

logger = system.util.getLogger("GatewayTagChangeScript")
logger.info("Relative Tag ID value: " + str(relativePathTagID))
logger.info("Absolute Tag ID value: "+ str(absolutePathTagID))

```

Logs:

 ![{43232151-1A38-4085-B2FF-E6F45C4260F6}](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/61ecccf694cae0953d441a52295af6ca446d9415.png)

Do gateway tag change scripts use a different way to reference relative tag paths? Or am I forced to construct the absolute path to read other tag values?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 20, 2024, 6:37pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876/2 "2024-11-20T18:37:51Z")

</div>

> [@Ben522326](#):
>
> Do gateway tag change scripts use a different way to reference relative tag paths?

You must construct a fully qualified path in the script.

Do not fear, as the event gives you the tools to work with.

```python
event.getTagPath()

```

Will return a Tag Path object.

This means that you can do something like this:

```python
logger = system.util.getLogger("GatewayTagChangeScript")
tagID = system.tag.readBlocking([event.getTagPath().parentPath.getChildPath("Tag ID")])[0].value
logger.info("Tag ID value: " + str(tagID))

```

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 20, 2024, 6:47pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876/3 "2024-11-20T18:47:30Z")

</div>

Can also be written as `event.tagPath` fwiw.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 21, 2024, 12:32pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876/4 "2024-11-21T12:32:08Z")

</div>

> [@bkarabinchak.psi](#):
>
> `event.tagPath` fwiw

I wasn't sure because the documentation is contradictory here.

> **[Tag Change Scripts​ - Gateway Event Scripts | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/scripting/scripting-in-ignition/gateway-event-scripts#tag-change-scripts)**
>
> Gateway Event Scripts are scripts that run directly on the Gateway. They are useful because they always run, regardless if any sessions or clients are open. They also provide a guaranteed way to make sure only a single execution of a particular...

There is both a `getTagPath()` and `tagPath` listed? 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 21, 2024, 1:30pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876/5 "2024-11-21T13:30:07Z")

</div>

Funny enough found this post from you - [Iterate Through Components In Container (Vision) - #10 by lrose](https://forum.inductiveautomation.com/t/iterate-through-components-in-container-vision/84512/10)

Though looking at the documentation I see what you mean, that is confusing.

---

<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:** [November 21, 2024, 5:03pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-cant-read-relative-tag-path-value/98876/6 "2024-11-21T17:03:48Z")

</div>

They are the same thing. Whoever wrote that part of the docs didn't understand what jython does with NetBeans-compliant getter/setter methods.
