Start and Run Two VIs Simultaneously in LabVIEW

Updated Jan 10, 2018

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base
  • LabVIEW Professional

Other

I would like to programmatically start and run multiple VIs at the same time. How can I do this?

Issue Details

I would like to programmatically start and run multiple VIs at the same time. How can I do this?

Solution

You can use a single VI to call any number of other subVIs by using the VI Server. The top-level VI will run as a "parent" VI, while all the called VIs run as "child" VIs. The following solution scales to large numbers of subVIs as well. Follow the steps below to call a subVI from within a top-level VI:
  1. Retrieve the path to the subVI you would like to run.
    • For example, we have used Strip Path and Build Path with the current VI's path to specify a subVI titled MyVI_2.vi that is located in the same folder as the calling VI. However, you can specify a VI located along any valid path in your system. See Related Links to learn more about specifying file paths in LabVIEW.
  2. Use the Open VI Reference.vi (located in the Programming»Application Control palette) in your top-level VI to obtain a reference to the VI you would like to run.
  3. Wire the reference to an Invoke Node (located in the same palette) with the Run VI method selected, which will run the subVI you have specified.
    • By wiring a false constant into the Wait Until Done property, we can prevent the calling VI from stalling while the subVI runs. As you might guess, this allows the two VIs to execute simultaneously.
  4. To show the child subVI's front panel, insert another Invoke Node into the chain and use the Open FP method to display the subVI's front panel on your desktop. If you do not call this method, your subVI will still run in the background.

WAS THIS ARTICLE HELPFUL?

Not Helpful