# New tag with Python script?

**URL:** <https://forum.inductiveautomation.com/t/new-tag-with-python-script/37209>\
**Category:** Ignition\
**Created:** [July 30, 2020, 7:40am UTC](https://forum.inductiveautomation.com/t/new-tag-with-python-script/37209 "2020-07-30T07:40:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amichailidis](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@amichailidis](https://forum.inductiveautomation.com/u/amichailidis)\
**Post date:** [July 30, 2020, 7:40am UTC](https://forum.inductiveautomation.com/t/new-tag-with-python-script/37209/1 "2020-07-30T07:40:53Z")

</div>

Hello Forum,  
is it possible to create a tag which will run a python script and calculate differences from other tags?  
what kind of display do i have to use? (label , numeric label etc) in order to see the data from the script.  
do i have to create the tag on the ignition designer or on the gateway?

many thanks!

---

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [July 30, 2020, 8:08am UTC](https://forum.inductiveautomation.com/t/new-tag-with-python-script/37209/2 "2020-07-30T08:08:38Z")

</div>

Tags live on the Gateway but are typically created using designer.

If you’re looking for a tag that calculates the difference between two other tags it will be much simpler to use an expression tag. The below link has a description and video to explain it.  
[https://docs.inductiveautomation.com/display/DOC80/Types+of+Tags#TypesofTags-ExpressionTags](https://docs.inductiveautomation.com/display/DOC80/Types+of+Tags#TypesofTags-ExpressionTags)

You can then use this tag with a numeric display to visualize it for an operator, or just see the value in the Tag Browser if that’s all you need to do.

---

<div class="post-metadata">

**Author:** ![amichailidis](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@amichailidis](https://forum.inductiveautomation.com/u/amichailidis)\
**Post date:** [July 30, 2020, 8:27am UTC](https://forum.inductiveautomation.com/t/new-tag-with-python-script/37209/3 "2020-07-30T08:27:34Z")

</div>

Thank you Bryan

i created the expression tag as value source expression and data type float but in the expression can i write python?  
when i write anything as a script inside i see a red X which indicates a bad tag.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 30, 2020, 11:38am UTC](https://forum.inductiveautomation.com/t/new-tag-with-python-script/37209/4 "2020-07-30T11:38:52Z")

</div>

Expression language differs from Jython.

[https://docs.inductiveautomation.com/display/DOC80/Scripting+Vs.+SQL+Vs.+Expressions](https://docs.inductiveautomation.com/display/DOC80/Scripting+Vs.+SQL+Vs.+Expressions)

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [July 30, 2020, 2:07pm UTC](https://forum.inductiveautomation.com/t/new-tag-with-python-script/37209/5 "2020-07-30T14:07:02Z")

</div>

The expression language addressed by @BryanB and @JordanCClark is great for simple calculations but if your calculation is more complex, you will want want a **tag event script**.  
You can write a python script that will execute whenever the value of one the tags of interest changes.  
Write the result of the calculation into a third tag that is displayed to the user.

Take a look at Inductive University Tag Event Scripts:  
[https://inductiveuniversity.com/video/tag-event-scripts/8.0?r=%2Fvideo%2Fsearch%2F%3Fq%3Dtag%20event%26checked\_topics%3D](https://inductiveuniversity.com/video/tag-event-scripts/8.0?r=%2Fvideo%2Fsearch%2F%3Fq%3Dtag%20event%26checked_topics%3D)
