Example Code

Call a SubVI Dynamically Within an Executable

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • LabVIEW

Code and Documents



Say you created an executable for your main VI, and the main VI opens and closes a subVI's front panel through an invoke node. However, when you build the executable, this subVI does not open or throws an error that it doesn´t find it. What should you do?



How to Use

The steps to call a subVI dynamically within an executable is: 

  1. In your SubVI: click File>>VI Properties>>Windows Appearance>>Customize and check "Show front panel when called."  (Alternatively you could program this behavior based on where it´s being called from; refer to Control When the Front Panel of a SubVI Opens in LabVIEW and "How to Determine if an Application is Running as a VI or as an Executable" KBs to do so.)
  2. In your calling VI: wire the name of your VI as a file path constant to the Open VI Reference, i.e. errorlog.vi.
  3. In your builder: go to Source Files and include your subVI as "Always Included."

Attached is an example for LabVIEW 2018. 

Related Links

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.