# Persistent Tag Issue and Forced Value in PLC After Script Execution

**URL:** <https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 11, 2024, 5:28pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271 "2024-05-11T17:28:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard\_espinal](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@richard\_espinal](https://forum.inductiveautomation.com/u/richard_espinal)\
**Post date:** [May 11, 2024, 5:28pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/1 "2024-05-11T17:28:51Z")

</div>

Hello,

I have encountered an issue with a script I created for a button to reset an alarm. Initially, I wrote the following script:  
import time  
system.tag.write("[default]IS15\_Overheight\_Rst\_PB", 1)  
time.sleep(1)  
system.tag.write("[default]IS15\_Overheight\_Rst\_PB", 0)

After running this script, the normally open contact remained pressed, and the tag continued to force a value of "1", despite the script having completed. I attempted to resolve the issue by deleting the script and the tag, but the problem persisted.

In an attempt to fix this, I recreated the tag under a different path and adjusted the script as follows:

import time  
system.tag.write("[default]OVERHEIGHT TAGS/IS 15 Tag", 1)  
time.sleep(1)  
system.tag.write("[default]OVERHEIGHT TAGS/IS 15 Tag", 0)

Now, the new tag appears locked and continues to force the "1" on my PLC. Could you provide guidance on how to resolve this issue and ensure that tags do not continue to enforce unwanted values after script execution?

---

<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:** [May 11, 2024, 5:39pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/2 "2024-05-11T17:39:58Z")

</div>

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831) and then use the pencil icon link to edit and fix. Thanks!

---

<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:** [May 11, 2024, 5:45pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/3 "2024-05-11T17:45:07Z")

</div>

This has been discussed many times on the forum. You can't rely on web-based HMI to turn off the tag and the use of `sleep()` is an indication that your logic is bad. You shouldn't use it.

Instead,

- Have the button set a bit in the PLC.
- Have the PLC reset the bit when the task is done.
- Have the Perspective indication tied to the PLC bit.

> [@How to create the momentary Button in Perspective](https://forum.inductiveautomation.com/t/how-to-create-the-momentary-button-in-perspective/63815/7):
>
> Because, with currently available components, there is no way to ensure the PLC gets its bit released (in a reasonably short bounded time, typically ~100ms) if: The browser hard crashes while the button is pressed, The browser encounters a javascript bug or sandbox violation while the button is pressed, Some other javascript operation hogs the CPU(s) (charts for the win!), delaying recognition of the mouse release, The websocket gets cut off between browser and gateway (for any reaso…

---

<div class="post-metadata">

**Author:** ![richard\_espinal](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@richard\_espinal](https://forum.inductiveautomation.com/u/richard_espinal)\
**Post date:** [May 11, 2024, 6:30pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/4 "2024-05-11T18:30:01Z")

</div>

```python
import time
system.tag.write("[default]IS15_Overheight_Rst_PB", 1)
time.sleep(1)
system.tag.write("[default]IS15_Overheight_Rst_PB", 0)

```

i deleted and but still having the same issue it keep, then i added the tag again and still showing 1 when is suppose to be "zero" i want to put everything back the way it was can you please help me with this?  
 ![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/f/3f44ac573bf7e863c26ea7e25da4d8176a6c5260.jpeg)

---

<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:** [May 11, 2024, 6:56pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/5 "2024-05-11T18:56:01Z")

</div>

![Enable read-write](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7d6ca93914ad98c492ac101aac61499e87ec61a7.png)

_Enable read-write._  
Then edit your tag value.

You didn't fix your original post as requested.

---

<div class="post-metadata">

**Author:** ![richard\_espinal](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@richard\_espinal](https://forum.inductiveautomation.com/u/richard_espinal)\
**Post date:** [May 11, 2024, 7:03pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/6 "2024-05-11T19:03:22Z")

</div>

sorry for the misunderstanding. but, after i did the script and deleted everything i try to bring back the same tag. the value is set two 1 when is supposed to be zero. i enable read-write and still have the same issue. who do i disable the script?

---

<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:** [May 11, 2024, 7:47pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/7 "2024-05-11T19:47:43Z")

</div>

> [@richard\_espinal](#):
>
> who do i disable the script?

Disable or delete the script wherever you created it. You said it was on a button so that would be in the button's Configure Events. (Right-click on the button → Configure Events.)

---

<div class="post-metadata">

**Author:** ![richard\_espinal](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@richard\_espinal](https://forum.inductiveautomation.com/u/richard_espinal)\
**Post date:** [May 11, 2024, 7:54pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/8 "2024-05-11T19:54:51Z")

</div>

I did it and I delete the script and then delete the tag and save the changes and still is showing 1. I brought back the tag again and it goes automatically to 1. the value is stuck in 1.

---

<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:** [May 11, 2024, 8:59pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/9 "2024-05-11T20:59:00Z")

</div>

![Tag to zero](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/b/6bf5d3e4c9dc772acadd98c10a7cd0b4b8f432a5.gif)

If that doesn't work there is something turning it on somewhere else or in your PLC.

---

<div class="post-metadata">

**Author:** ![richard\_espinal](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@richard\_espinal](https://forum.inductiveautomation.com/u/richard_espinal)\
**Post date:** [May 11, 2024, 9:34pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/10 "2024-05-11T21:34:11Z")

</div>

that happend exactly after i did the script. so can i just download the most recent backup on my plc and that might fix this issue. I heard from a coworker that doing the momentary button might latch the plc. he told me he saw it in the post office with panelview. please advice?

---

<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:** [May 11, 2024, 9:43pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/11 "2024-05-11T21:43:06Z")

</div>

> so can i just download the most recent backup on my plc and that might fix this issue.

You can try, but that's not the problem unless you have changed the PLC code.

> I heard from a coworker that doing the momentary button might latch the plc.

Not likely.

---

<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 11, 2024, 11:09pm UTC](https://forum.inductiveautomation.com/t/persistent-tag-issue-and-forced-value-in-plc-after-script-execution/90271/12 "2024-05-11T23:09:50Z")

</div>

> [@richard\_espinal](#):
>
> told me he saw it in the post office with panelview.

Yes, Panelviews can experience this problem (with ordinary TCP/IP-based drivers), though much more rare than for a browser. Some reading:

[https://forum.inductiveautomation.com/search?q=momentary%20button%20stuck%20order%3Alatest](https://forum.inductiveautomation.com/search?q=momentary%20button%20stuck%20order%3Alatest)
