You could try using the os.
import os myfile = r"C:\Path\TestProject.aprx" os.system("start " + myfile)
* After some testing this works better. You could also probably use the subprocess Popen too?
import os myfile = r"C:\Path\TestProject.aprx" os.startfile(myfile)
Not that I can figure out. When I run into situations like this in Pro I will use Tasks. You can have the python script run but don't include the importDocument in a step, make a new step to Import Map (noting exactly how/where to get the map file), ect. You can have each step run automatically one right after another. Not ideal, but if you need a bit of handholding for those less familiar with the software it works great.
Also, you might be able to do this with the Pro SDK within IProjectItem then AddItem.
it opens a new instance.
What is it you want to do?
You can access properties of the aprx etcetera to add to the current project.
It isn't clear what your intent is.
Hi Dan, as stated in my initial post, my intent is to open a map window which has been imported from a .mapx file. I'm trying to get this to work from a custom geoprocessing tool which is run in ArcGIS Pro.
In the GUI if I select Insert -> Import Map and point to the .mapx file, it adds the map to the 'Maps' section of the catalog, and opens the map window too.
In Arcpy if I use aprx.importDocument('.mapx file') it adds the map to the catalog but doesn't open the map window. I'm trying to work out if I can then open the map window using arcpy.
Hopefully that makes the intent more clear, thanks.
That's what I though. In my initial post, I couldn't find any "open" method in either of the links...
I am wondering if you have to construct it from an active mapview, but I definitely haven't tested.