I believe Dippi misunderstood your question, and it is a valid one. You can have the same VI open in multiple contexts, such as two different projects, or one project and the default context (no project). I don't believe there is any programmatic way to determine what context the VI has been launched in. Your best bet might be to create two launcher VIs, one for project A and one for B. Both will launch Main.vi and pass it a string with the respective project name, or perhaps just the correct reference.
Regarding your second question, you can indeed get a list of all child items in a given project. Start by taking the project reference and getting a reference to all the Targets (such as My Computer or your RT Targets). Index out the one of interest (My Computer will be the first target in the array). Then use a property node on the target reference to get the Children[ ] array. I'm not sure if there are specific properties to tell if these children are libraries or not (you can tell if they're VIs or variables, for instance). But you could probably just check the names of the Children for the .lvlib extension. Shouldn't be too hard...
Let us know how it comes along. Good luck!
Jarrod S.
National Instruments