07-15-2022 03:02 PM
I'm assuming most of you know what this means, but in Python you can have a module with a number of functions in it, and can be imported into your main program file to be used at will. But you can also put an if statement in that module that basically detects if it was ran separately without being imported. And then in that if statement you can have code that does whatever. But that code doesn't run if it was being imported into another file.
Does LabVIEW have anything like this for VI's?
07-15-2022 03:07 PM
No because LabVIEW does not have the concept of a file import. What are you trying to accomplish?
07-16-2022 01:29 AM
You could examine the number of elements in the Call Chain, which might give you what you want (and then a Case Structure or similar).
I'm not sure off the top of my head how this behaves with VIs called by reference, but I'd hope it should work then too...
07-16-2022 12:13 PM - edited 07-16-2022 12:19 PM
You can look a the Run State property to see if it is Running Top Level. A VI is considered Running Top Level if it is running and has no callers running in the same context.
The caveat here is that a vi launched Fire'n'forget from an ACBR may change state from Running to Running Top Level when the caller goes Idle. (A quick test vi would demonstrate if it does do that. Personally, I believe that would be proper behavior but, I never tried it)