# Getting "object has no attribute" error in Msg Hdlr for custom property on View Root

**URL:** <https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162>\
**Category:** Ignition\
**Tags:** ignition80, perspective, scripting\
**Created:** [October 20, 2021, 2:56pm UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162 "2021-10-20T14:56:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeAllgood](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@MikeAllgood](https://forum.inductiveautomation.com/u/MikeAllgood)\
**Post date:** [October 20, 2021, 2:56pm UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162/1 "2021-10-20T14:56:19Z")

</div>

Hi have a Message Handler on the root of a Perspective view.  
In the script I am assigning a varialbe to the value contained in a root.custom.property.  
When this script runs I get the following error:

```auto
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 11, in onMessageReceived AttributeError: 'com.inductiveautomation.perspective.gateway.script' object has no attribute 'workOrderQuantity'
at org.python.core.Py.AttributeError(Py.java:207)
at org.python.core.PyObject.noAttributeError(PyObject.java:1032)
at org.python.core.PyObject. __getattr__ (PyObject.java:1027)
at org.python.pycode._pyx187.onMessageReceived$1(:12)
at org.python.pycode._pyx187.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function ___call__ (PyFunction.java:471)
at org.python.core.PyFunction. __call__ (PyFunction.java:466)
at org.python.core.PyFunction. __call__ (PyFunction.java:461)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:822)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:806)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:687)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:965)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:752)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:101)
at com.inductiveautomation.perspective.gateway.model.MessageHandlerCollection$MessageHandlerImpl$1.lambda$invoke$0(MessageHandlerCollection.java:80)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 11, in onMessageReceived AttributeError: 'com.inductiveautomation.perspective.gateway.script' object has no attribute 'workOrderQuantity'

```

The Custom Property is shown in the screen grab below:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e0899972f7e27852eac91c0819f035a373842271.png)

The script is as follows:

```auto
	self.refreshBinding("custom.dsWOTotals")
	self.refreshBinding("custom.workOrderOpSubmitted")
	self.refreshBinding("custom.qtyCompleted")
	self.refreshBinding("custom.qtyRejected")
	self.refreshBinding("custom.workOrderStatus")
	self.refreshBinding("custom.workOrderQuantity")
	self.refreshBinding("custom.workOrderPartNumber")
	self.refreshBinding("custom.enabelWorkOrderEdit")
	qty = self.custom.workOrderQuantity
	self.view.params.qtyOrdered = qty

```

Note: I set the qty variable = to the custom property to isolate it from the line setting the view’s parameter.  
As I used the Property Browser in the script editor for the message handler, I know the spelling and path to the property are both correct.

Any ideas why I’m getting this error?  
The error also generates after I’ve saved the view, closed the project, and re-open the project and view (the message handler is called by an onStartup script in the view to refresh the data bindings in the view).

Thanks.

---

<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:** [October 20, 2021, 3:41pm UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162/2 "2021-10-20T15:41:40Z")

</div>

`.refreshBinding()` is not synchronous. You’ve told `custom.workOrderQuantity` to refresh and then you immediately reference its value. Can’t count on that. You’ll need a propertyChange action on the property to know the value is available. Or a binding.

---

<div class="post-metadata">

**Author:** ![MikeAllgood](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@MikeAllgood](https://forum.inductiveautomation.com/u/MikeAllgood)\
**Post date:** [October 20, 2021, 3:56pm UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162/3 "2021-10-20T15:56:28Z")

</div>

Thanks Phil.  
I had not even considered that.  
There is so much to know about Ignition and I have very limited free gray matter! 🙃

---

<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:** [October 20, 2021, 4:03pm UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162/4 "2021-10-20T16:03:47Z")

</div>

Hmm, `refreshBinding` looks like it’s _attempting_ to be synchronous…

@MikeAllgood, before you attempt to assign, can you try adding:

```auto
system.perspective.print(type(self.custom))
system.perspective.print(dir(self.custom))

```

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [October 21, 2021, 6:46am UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162/5 "2021-10-21T06:46:01Z")

</div>

> [@MikeAllgood](#):
>
> `self.refreshBinding("custom.dsWOTotals")`

You are calling these in the root or the component above the root?

---

<div class="post-metadata">

**Author:** ![MikeAllgood](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@MikeAllgood](https://forum.inductiveautomation.com/u/MikeAllgood)\
**Post date:** [October 21, 2021, 1:10pm UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162/6 "2021-10-21T13:10:51Z")

</div>

The refresh Message Handler script, that this script is in, is on the root of the view. The refreshBinding functions are working properly. It’s the use of self.custom.workOrderQuantity that is throwing the error.

---

<div class="post-metadata">

**Author:** ![bebel](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bebel](https://forum.inductiveautomation.com/u/bebel)\
**Post date:** [February 21, 2022, 7:13pm UTC](https://forum.inductiveautomation.com/t/getting-object-has-no-attribute-error-in-msg-hdlr-for-custom-property-on-view-root/52162/7 "2022-02-21T19:13:36Z")

</div>

I’m not sure anyone answered the actual question. The bindings are may be out of date as pointed out, but the object should still exist, which is the error.  
I was having the same issue and I am not doing any refreshing. Things were working fine in the designer but I was getting an error stating that a custom property did not exist when running a session. When I closed the designer and reopened it, I found I did have the same error.  
I found was there were custom properties that were disappearing from the object, but not the one that I was getting the error for. When I added the two missing parameters back, their bindings would also magically reappear. This was repeatable, close the designer, reopen and they are gone. What I found was that I had changed the name of an object that was used in the bindings for those two parameters and not fixed the bindings. Once I fixed that, all was well. I have no idea why it was giving an error for a parameter that was not actually disappearing or why the system would be programmed to make parameters invisible if they had a problem with the binding.
