Arcpy Pro importDocument

1794
2
Jump to solution
02-08-2019 07:27 AM
JaredPilbeam2
MVP Regular Contributor

I'm working from the Python console in Pro 2.3 and when I importDocument it seems to work but nothing opens. The parameters call for the document and it's layout, so I tried that too. Is there another step that I'm missing?

import arcpy
p = arcpy.mp.ArcGISProject('CURRENT')
#importDocument(document_path, {include_layout})
p.importDocument(r'path\to\MUNICIPAL_LIMITS_A.aprx')‍‍‍‍‍‍‍

There was a similar question to mine here, but it's sort of dated:

arcpy - Importing MXD to ArcGIS Pro programmatically? - Geographic Information Systems Stack Exchang... 

"To follow up on my comment, the code you posted does work, but does not automatically open the newly imported map."

0 Kudos
1 Solution

Accepted Solutions
EarlMedina
Esri Regular Contributor

Jared, this one has tripped me up in the past as well! You'd certainly think the result would open automatically but that is not the case.

Instead, you'll go to Catalog > Project > Maps to locate the imported .aprx.

View solution in original post

2 Replies
DanPatterson_Retired
MVP Emeritus

ArcGISProject—ArcPy | ArcGIS Desktop 

still the same... no mention of opening anything, just adding to the project

but the elements are accessible

[i.name for i in project.listMaps()]
['Ice', 'Ice_01', 'fd3b', 'Map', 'X', 'Map1', 'Y', 'fordan3_a ice', 'fordan3_b', 'Z']

Perhaps the intent of the importDocument, is to access elements from within the project to change those etc.  Most of the examples are or modifying project elements without having to open projects or publishing/saving elements like layouts to different formats

EarlMedina
Esri Regular Contributor

Jared, this one has tripped me up in the past as well! You'd certainly think the result would open automatically but that is not the case.

Instead, you'll go to Catalog > Project > Maps to locate the imported .aprx.