Testing Vision Templates directly in IDE - Template uses stale project Scripts?

When testing a Template directly in the Vision IDE (using ‘Preview’ mode) the templates seem to be working with stale copies of any project scripts they call (i.e. the version loaded with the project when it was first opened).

For example - I’m working on a template that calls a function in one of my project scripts. There is a typo in a variable name in the function so I get the typical NameError exception (since the variable hasn’t been defined) when I preview the template in the IDE and it calls the script. No problem, I fix the typo in the script and save everything and test the template again. I get the same error with the same line number referenced - but the script has been saved and the error is no longer there. If I call the project script from a Window in the project, there are no issues - the Window calls the updated (i.e. fixed) script. Likewise, if I put the template onto a Window and preview it from there, no issues - the template uses the updated script. It’s only when previewing the template directly that this behavior seems to occur. Only way to get the updated script to be used by the Template when previewing is to close the project and re-open it.

Any ideas? I can put the template on a Window to get around this, but it seems like a bug. It’s obvious when it results in an exception, but if the change is more subtle this could cause the developer a lot of headaches trying to debug scripts that aren’t even running.

Thanks

What version of Ignition?

8.1.7

Is there something weird going on with inheritance? IE is the script in a project that the project with the template in it inheriting? I have had some strange things happen with inheritance and saving.

No inheritance. It’s just a standard project. Tried restarting the gateway too, still happens. If it is a bug should be pretty easy for anyone to reproduce:

  1. Create a template that calls a project script and save the template.
  2. Make a change to the script and save it.
  3. Preview the template (directly, not on a window) in the IDE and see if the change made to the script is applied when the template calls the script again.

Are you importing your script or calling the full name?

The script is not being imported, it is part of the same project. It seems to update fine everywhere except when previewing a template directly.

After you edit your script and save, if you make an edit to your template and save, before previewing, does it have any impact? Can you share the code from your template that you are using to invoke the script?

The calling code is just: General.filterDataset(dataset, filter_cols, filter_str). It’s a simple function inside a project script called ‘General’ that executes some regex code on a set of columns in a dataset and returns a dataset containing all matched rows. Everything is defined in the project itself. No imports, no project inheritance, etc.

I think we are going off on a tangent here. There is nothing wrong with how the script is called or the contents of the script itself. I know this because:
A.) Previewing a template on a window - the updated version of the script is called and works exactly as expected.
B.) Previewing a template directly - the version of the script opened with the project is used, no updates made to the script in the current session are pulled in.

It doesn’t matter what template is being used, nor what script is being called. It’s always the same behavior. This would be easy for anyone to verify as either a problem in Ignition (if they get the same behavior) or a problem with my install specifically (if they get different behavior).

I have tried saving/committing everything before previewing (template, scripts, project, etc.) - nothing causes the proper version of the script to be used in scenario B.
Only closing the project and re-opening it will pull in the updated script when previewing the template directly in the IDE (of course this still isn’t ideal since the template is still just using a snapshot of the script at project open, and will still not pull in any subsequent updates).

It’s really not a big deal - I can just put the template on a window and preview there. Just highlighting this issues for IA and others who may encounter this (or to understand if this is only happening to me due to something weird with my install).

Probably worth reporting to support as a bug.

I’ve seen this before, but I recall being able to resolve it by closing/reopening the template.