Showing results for 
Search instead for 
Did you mean: 

Opening or closing a Vi from two different Applications



i want to automatically open or close a Vi from another vi. The two Vis are in different Projects. When opening my VI_1 (see png) from the VI_2 i have the following error: Error 7 occurede at open File.

In the VI_1 the SettingFiles cannot be loaded. Please ignore what is happening in the While-Lopp of the VI_2. The VI_2 is just there to open and close the VI_1


Please can anyone help me.


Download All
0 Kudos
Message 1 of 13

If you want to have two instances of a Vi running at the same time, it needs to be reentrant.



You forgot to attach VI_2. You really don't provide sufficient information. Opening which file gives the error? Can you give the full error message? We are also missing all the subVIs.


Can you describe what you men by "different projects"?

0 Kudos
Message 2 of 13


sorry for the confusion. i will satrt back from the beginning.

i actually have two VIs located at different places and in two different Projects, VI_1 and  VI_2. i want to run VI_2 from VI_1. In VI_2 i have a conditional disable structure that opens a Folders where my  Setting Files are located depending on if i am running the Programm in RunTimeEngine odr Default. In my Setting Files i have an .xml File containing my Initialisation information.

 The problem i have is, when i open my VI_2 i get an error message(see Photo Error Message) .

My question is: Please how can i open VI_2 from VI_1 without having any error even though they are not in the same Project .

Download All
0 Kudos
Message 3 of 13

In the text you say "two different projects", but in the subject you say "two different applications". When building the application, you should probably "always include" whatever is called dynamically. If you would use a static VI reference instead, things would be simpler.

0 Kudos
Message 4 of 13

Hallo @altenbach.

please what do you mean exactly?

0 Kudos
Message 5 of 13

When you use the LabVIEW Project file to organize a LabVIEW Project (something I highly recommend), you want all of the VIs needed by the Project to be "available" within the Project File.  But what do you do if you have a VI that is "the same" for more than one Project?


Part of the answer to this question involves how you organize your Project on disk.  I usually make a Project Folder that contains (almost all) the VIs, perhaps organized in sub-folders of "Top-Level VIs", "Sub-VI", "Type Defs", etc. and have the Project structure mimic the disk structure.  Did you notice the "almost all" in the previous sentence?  There are also "library" files that I use, source files (such as the OpenG Library) that get installed in C:\Program Files\National Instruments\LabVIEW xxxx\user.lib or some other common (and "isolated") safe place, but if it is a sub-VI that I wrote "for myself" and use (without change!) in multiple Projects, then I create multiple copies in each Project as needed.  


This is the "simple solution" to your dilemma.  You have two Project Folders on disk for your two Projects.  If you have a function ("MyFunction") or sub-VI ("MySubVI") located in the Project1 folder that you want to use in Project 2, make a copy of it in the Project2 folder and be sure to include that copy when you open up Project 2 in LabVIEW.


Note this works well for small and medium-size Projects, particularly those that have "rare" "duplicates".  For large Projects that are complex and have complex sub-components shared among them, building common User Libraries, a more-advanced technique (that I haven't entirely mastered) is probably advised.


Bob Schor

0 Kudos
Message 7 of 13

Since you're trying to open a file with a relative file path you need to have the VI in the same relative folder, in this case under a settingfiles folder parallell to your main vi. This should work fine assuming you e.g. have a SettingFiles and in parallell your project folders.

If they're located further apart you can e.g. make a hard link "mklink /d [folder]" to have the same structure.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
0 Kudos
Message 8 of 13



i tried with a static VI reference but i was unable to create a static VI reference for a vi existing in another Project in a new Project. 

My main Problem is that my two Vis are not in the same Project. 

Please can someone help me out. i understand how i can run to individual VIs, but i am unable to run them  from two different Projects

0 Kudos
Message 9 of 13



For large Projects that are complex and have complex sub-components shared among them, building common User Libraries, a more-advanced technique (that I haven't entirely mastered) is probably advised>> do you mean creating a packed project Library? if not please can you give me a hint on what to do? thanks in advance

0 Kudos
Message 10 of 13