LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Python has "if __name__ == "__main__": ". Does LabVIEW have anything like this for VI's?

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? 

0 Kudos
Message 1 of 4
(197 Views)

No because LabVIEW does not have the concept of a file import. What are you trying to accomplish?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 4
(194 Views)

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...


GCentral
0 Kudos
Message 3 of 4
(146 Views)

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)


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 4
(120 Views)