BUG? custom methods in Root container not executed when called with unknown parameter

Today I had some issues with self written custom methods in root container of Main window in Vision. When calling one method from another method and passing parameter that have not been used before (e.g. renamed variable in calling method but forgot to rename in method call) execution is stopped without any notice, neither syntax error is displayed nor exception gets thrown in console.
Is this a feature?

Please show your code.

copy & paste right now does not work from within Scripting Editor, is there a way to fix it?
I will try to restart and paste my code tomorrow.

It never shows a right-click menu. It only works with Ctrl-C, Ctrl-X, Ctrl-V.

2 Likes

omg, did I tell that no context menu appears? I believe not.
Ctrl-C did for whatever reason not copy the code from scripting editor, so that Ctrl-V always pasted what had been copied to clipboard earlier. I just restarted Ignition Designer and Ctrl-C still does not copy the script code from Script editor when marking the whole method code. When just marking the code beginning in line 2 it then works. Also when marking using Shift+Arrow keys it only works until cursor jumps into line 1, then it stops working, so there is definitely something wrong with script editor…

So here is Function 1:

def Tets(self, serial):
	print("This is Test function in Root container of Main Window:",serial)
	serialNo="123456"
	'''
	this is just an example
	'''
	print("Now Test2 will be called with (serialNo)")
	self.Test2(serialNo)
	print("Now Test2 will be called with (serialNumber)")
	self.Test2(serialNumber)
	print("Test function finished")

and Function 2:

def Test2(self, serial):
	print("This is Test2 function in Root container of Main Window:",serial)

So when Test gets executed it just runs to the line where “Now Test2 will be called with (serialNumber)” gets printed to console, print from Functin Test2 then does not happen and no exception in console.

To be more precise, when starting with this example it indeed gives an exception on the first run, but not on second one. So if variable would be correct for first run and I then modify code press Apply and continue testing it then will not give an exception.

No, but this is your first post here and it is a common mistake worth ruling out. The inability to cut/copy/paste when the function header (and pre-defined comment of extension functions) is selected is deliberate on IA’s part, presumably to prevent attempts to paste into the non-editable section.

But hey, I’ll honor your implicit request to only be helped when I can absolutely understand every nuance of your case.

Well you’re right, from your point of view your response is absolutely understandable :wink:
Didn’t want to grumble on you, I just felt bugged because Ignition (from my point of view poor debugging features) sometimes seems to be not that intuitive as I expected (e.g. no intellisense etc…).
If the copy paste thing really is as designed I would then wonder why it does not give any message telling about that. Or only preventing pasting would also be a way I could comprehend.

They’ve taken quite a bit of heat for their lame script editors (yes, there are multiple editors). Which is why upgrading the editors was a big hit on their ideas site, and is in progress. With a fair amount of input from us plebes, if you look around the forum.

As to the error reporting, please recheck if you fail to get a new error message after editing. Ignition does suppress duplicate errors in many contexts, but that should reset on edits.

Thank you for pointing out the supression of duplicate error messages. Just rechecked and it seems that directly after applying the edit (leading to wrong parameter) there indeed was an exception listed.
So I will mark your reply as solution :smiley:
Btw you mentioned different editors, what about the client tag editor? This one is not displayed in Taskbar as separate window, the Component Scripting editors are dsiplayed. This sometimes confuses me when looking for the right Editor…