# Arcpy Pro importDocument

697
2
02-08-2019 07:27 AM
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:

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

Tags (3)
1 Solution

Accepted Solutions
Esri 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.

2 Replies
MVP Esteemed Contributor

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

Esri 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.