# Error on Property Change Script

**URL:** <https://forum.inductiveautomation.com/t/error-on-property-change-script/95533>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [September 4, 2024, 4:12pm UTC](https://forum.inductiveautomation.com/t/error-on-property-change-script/95533 "2024-09-04T16:12:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Craig](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Ryan\_Craig](https://forum.inductiveautomation.com/u/Ryan_Craig)\
**Post date:** [September 4, 2024, 4:12pm UTC](https://forum.inductiveautomation.com/t/error-on-property-change-script/95533/1 "2024-09-04T16:12:13Z")

</div>

I created a property change script that is supposed to open a pop up if the color of the label changes. The pop up seems to work fine and as it is supposed to, but now whenever I open up the page in the designer, I am getting this error:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/1/41fcc7ae5e41b7a6cb57af46bad944216b1237f7.png)

Here is the script the error is referring to:

```python
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if previousValue.value != currentValue.value:
			system.perspective.openPopup('FlashingPopup_RMC', 'OperationsPages/FlashingPopup_RMC')

```

I am confused because the pop up function is work as planned. Any ideas on how to address/fix this error?

---

<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:** [September 4, 2024, 4:20pm UTC](https://forum.inductiveautomation.com/t/error-on-property-change-script/95533/2 "2024-09-04T16:20:08Z")

</div>

`NoneType` object has no attribute X is the Python equivalent of a null pointer exception.

When you first open the view, there _is_ no `previousValue`. So `previousValue.value`... doesn't exist.

Try:

```python
	if previousValue is not None and previousValue.value != currentValue.value:

```

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [September 4, 2024, 9:01pm UTC](https://forum.inductiveautomation.com/t/error-on-property-change-script/95533/3 "2024-09-04T21:01:53Z")

</div>

I had the [same issue](https://forum.inductiveautomation.com/t/playsoundclip-repeatedly/95345/21). Checking for `not initalChange` works as well.

---

<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:** [September 4, 2024, 9:03pm UTC](https://forum.inductiveautomation.com/t/error-on-property-change-script/95533/4 "2024-09-04T21:03:41Z")

</div>

> [@amarks](#):
>
> Checking for `not initalChange` works as well.

Doesn't exist for Perspective property change events.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [September 4, 2024, 9:04pm UTC](https://forum.inductiveautomation.com/t/error-on-property-change-script/95533/5 "2024-09-04T21:04:11Z")

</div>

ah, yes. I forget it exists because I basically don't use it 😅
