Views in designer not "seeing" project script changes

I’m having a strange problem with my designer since upgrading to 8.0.5. When I make changes to a Project Library script, and then refresh a binding which uses that script in a transform, it seems to still have the old version of the script in a cache of some sort.

For example, I will get an error on a binding, with a reference to the line of code in my Project Library script which is causing the problem because I misspelled the python “replace” function as “repalce”. I open the script, change the code completely to use a regex instead, and save it. When I go back to the View and refresh the binding, it still refers to the same error, which is no longer part of the code.

The only way I’ve found to get around this is to close and reopen the designer after saving the script. I was not having this problem before upgrading to 8.0.5. Has anyone else had this problem?

I may be seeing the issue you are seeing, however I want to make sure because I am seeing it in 8.0.4 as well.
If you reproduce this again, are you able to fix it by opening the binding screen for the property not being updated and clicking “OK” to refresh the binding instead of using the refreshBinding() method I assume you are using.

I hadn’t even considered the refreshBinding() method. I’ve run into the problem by opening the binding and clicking “OK” or “Apply”, and by closing and reopening the view. The only way I’ve been able to get changes to project scripts applied when called in a binding transform script is to either close the designer and relaunch it, or to re-open the project from the file menu.

Ah alright. That sounds like a pretty substantial issue then. I haven’t been able to replicate on 8.0.5, at this point if you wouldn’t mind I can take a look at your project via project export. Otherwise, you will have to contact support for this as it should not be functioning like that.

This project inherits from other projects, and depends upon tag values for some variables, so looking at it via export might not be the simplest thing. (Note, the problem is with scripts in this project’s library, not the inherited ones.) Why don’t I verify that I get the same results on a simpler project, and if so I will export that and send it to you.

I have already tried this same project on another gateway, and gotten the same result, so this should tell us if the problem is somehow specific to this project. I’ll report back with the results.

1 Like

I think I have figured out what causes this problem. I made a little project where one label gets its value by passing a parameter to a project script. At first I was not seeing the same behavior. But then I made the project inheritable and tried it again, and that’s what made the problem reappear.

As long as I was testing this out, I added a project that inherits from this one, and uses the script in its own view binding. If I modify the script in the parent project, save the project, update the child project with Gateway changes, and finally refresh the binding, the binding uses the new version of the script.

Given this information, it’s probably just a coincidence that I first saw this happen after upgrading to 8.0.5. I probably just hadn’t tested scripts through views in an inheritable project before upgrading.

When I have an inheritable project, the script still updates when I refresh the binding. Mind sending me your test project?

This sounds like expected behavior.

Sure thing. How would you like me to send it to you?

:+1:

If you can just drop the zip export onto a comment here or DM it to me that’d work.

Ah, didn’t realize I could put attachments on comments.

It’s pretty straightforward. When I open TestView and change parent.custom.testKey, that value gets passed to NewScriptA.propToLabel(), and the results gets written to the label’s text. If I then open up NewScriptA and change the script to return different results and save, the label never gets those new return values, no matter how many times I change the property its bound to, or refresh the bindings. Only when I reload the project do the new values appear in the binding.

ScriptTesting_2019-10-22_1653.zip (7.9 KB)

I am still seeing the same behavior as before on my end. It could be environment related or any number of other things. At this point I will have to just suggest you get in touch with support as they will have the ability to see what is going on first hand and hopefully get us some way to reproduce it on our side and get this fixed.

I’ve had the same problem with version 8.0.4.
It doesn’t happen all the time. Just when it’s late and I’m tired :slight_smile:
I had a script that was being called from a button in Vision. After updating and saving the script, the button kept using the old script. It didn’t matter what I did: save, edit, re-edit and save… it just kept running the old script. To get it to work I changed the name of the script file and updated the reference on the button and it worked again. However, on my next edit it did the same thing. I got to version 5 on my script before I was finalised.
It’s only happeded a couple of times, but it’s very frustrating when it does.

I hadn’t considered renaming the script. I’m sure that’s still frustrating, but it sounds less disruptive than reloading the project every time. I’ll do that until I can get support to figure out the problem.

Will do. Thank you for your efforts.

I know it’s almost a year later but I’ve been seeing this same issue in 8.0.15.

In a Vision propertyChange script, we were calling a project script function to update some tags. We renamed/move tags around to clean things up and fixed the script. The propertyChange script was stilling using the old version of the function.

So far, I have found two ways to fix this particular issue:

  • Close the designer and reopen it.
  • In the propertyChange script we were importing the function and then using it where needed. If I remove the import and just call the function based on its full path seems to call the live version every time.

You should never import project scripts. For this very reason. The dependencies cannot be tracked and are therefore not updated upon changes. Always use the full names. If you must, assign the name of a project script to a function local variable to be used immediately. Do not allow such to persist.

I’m also seeing this issue (also in 8.0.15). I’m not importing the Project library I’m invoking an instance of a class from a custom method on a perspective component

In libraryname I have:

class bar:
    def __init__(self, params):
         system.perspective.print("Hello World")
         <More code here>

Then in the custom method I have

foo=libraryname.bar(parameters)

I can add and remove the Hello World and it has no effect on the behavior of the program until I restart the designer. I can’t work like that.

edited to add: The forum stripped all the formatting and underscores off my code there but you should be able to figure out what I was going for.

1 Like

I work with Mike; We are also seeing changes to Named Queries intermittently not be committed when saved.

You need to mark your code with the button that looks like this: </>. You can edit the post above to make it readable. Indenting matters in python, so no, we can't figure it out.

I’m having this same issue in ver 8.1.1

My script changes are not being seen until I close designer and reopen it.

I’m able to repeat this issue fairly consistently.

I do have an inherited project. I’m going to move my script there and test further. Any other suggestions ?