# Tag readAsync callback return with tag paths

**URL:** <https://forum.inductiveautomation.com/t/tag-readasync-callback-return-with-tag-paths/94773>\
**Category:** Ignition\
**Created:** [August 16, 2024, 10:32pm UTC](https://forum.inductiveautomation.com/t/tag-readasync-callback-return-with-tag-paths/94773 "2024-08-16T22:32:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JHortenberry](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@JHortenberry](https://forum.inductiveautomation.com/u/JHortenberry)\
**Post date:** [August 16, 2024, 10:32pm UTC](https://forum.inductiveautomation.com/t/tag-readasync-callback-return-with-tag-paths/94773/1 "2024-08-16T22:32:34Z")

</div>

Is there a way to get the corresponding tag path to return with the value in a callback function called from readAsync?

I need to modify each tag value...for many values.

( I know there are other ways ... I was trying to get the Async method to work.)

def callback(items):

```
for item in items:
        #print item.tagPath
        # -- need to modify each tag value --
        print item.value

```

tagPaths =

tagPaths.append('[default]Tag1')  
tagPaths.append('[default]Tag2')  
tagPaths.append(' ... ')

system.tag.readAsync(tagPaths, callback)

NOTE: dir(item)  
['BAD', 'CONFIG\_ERROR', 'DISABLED', 'EXPRESSION\_EVAL\_ERROR', 'INITIAL\_VALUE', 'NOT\_CONNECTED', 'NOT\_FOUND', 'REFERENCE\_NOT\_FOUND', 'STALE', 'TRANSFORM\_ERROR', 'TYPE\_CONVERSION', 'UNKNOWN', 'UNSUPPORTED', ' **class**', ' **copy**', ' **deepcopy**', ' **delattr**', ' **doc**', ' **ensure\_finalizer**', ' **eq**', ' **format**', ' **getattribute**', ' **hash**', ' **init**', ' **ne**', ' **new**', ' **reduce**', ' **reduce\_ex**', ' **repr**', ' **setattr**', ' **str**', ' **subclasshook**', ' **unicode**', 'class', 'clone', 'derive', 'equals', 'fromObject', 'getClass', 'getQuality', 'getTimestamp', 'getValue', 'hashCode', 'notify', 'notifyAll', 'quality', 'setQuality', 'setTimestamp', 'setValue', 'timestamp', 'toString', 'unwrap', 'updateTimestamp', 'value', 'valueOf', 'wait']

---

<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:** [August 16, 2024, 10:35pm UTC](https://forum.inductiveautomation.com/t/tag-readasync-callback-return-with-tag-paths/94773/2 "2024-08-16T22:35:05Z")

</div>

Just pass them in yourself.

```python
def callback(paths, items):
   # ...

tagPaths = []
# ...

system.tag.readAsync(tagPaths, lambda items: callback(tagPaths, items))

```

note that "items" is a poor name for what is a list of QualifiedValue objects.

---

<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:** [August 16, 2024, 11:58pm UTC](https://forum.inductiveautomation.com/t/tag-readasync-callback-return-with-tag-paths/94773/3 "2024-08-16T23:58:35Z")

</div>

> [@Kevin.Herron](#):
>
> `lambda`

If find it easiest to just use the closure a `def` produces if you use a `def` anyways:

```python
tagPaths = [....]

def callback(qvList):
	for tagPath, qv in zip(tagPaths, qvList):
		# Do whatever

system.tag.readAsync(tagPaths, callback)

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 17, 2024, 12:05am UTC](https://forum.inductiveautomation.com/t/tag-readasync-callback-return-with-tag-paths/94773/4 "2024-08-17T00:05:17Z")

</div>

@JHortenberry: Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). Your indentation and formatting is messed up.

---

<div class="post-metadata">

**Author:** ![JHortenberry](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@JHortenberry](https://forum.inductiveautomation.com/u/JHortenberry)\
**Post date:** [August 17, 2024, 6:25pm UTC](https://forum.inductiveautomation.com/t/tag-readasync-callback-return-with-tag-paths/94773/5 "2024-08-17T18:25:32Z")

</div>

An equally good solution...

Thanks Guys!
