<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Arcpy Import MXD into ArcGIS Pro Project in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236558#M66199</link>
    <description>&lt;P&gt;You don't save the aprx, so when the script runs, it doesn't retain anything, I suspect.&lt;/P&gt;&lt;P&gt;When you run it within Pro it probably loads, but if you don't save the project, they will vanish as well&lt;/P&gt;&lt;P&gt;see 'save' or saveACopy in&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank"&gt;ArcGISProject—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Nov 2022 19:58:17 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2022-11-30T19:58:17Z</dc:date>
    <item>
      <title>Arcpy Import MXD into ArcGIS Pro Project</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236541#M66198</link>
      <description>&lt;P&gt;I am trying to import multiple MXDs into an existing ArcGIS Pro project using arcpy.&lt;/P&gt;&lt;P&gt;When I run the code it completes successfully but when I open the ArcGIS Pro project there is nothing there. I changed the Pro Project variable to 'CURRENT' and inserted the code in ArcGIS Pro's Python terminal and it works fine. Just confused on why the script would run in ArcGIS Pro and not outside.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;# Specify the mxd directory&lt;BR /&gt;&lt;/SPAN&gt;mxdDir = &lt;SPAN&gt;r'C:\Users\rossch\Downloads\NS114_BasemapMXDs'&lt;BR /&gt;&lt;/SPAN&gt;proProj = &lt;SPAN&gt;'C:\Users\rossch\Downloads\ArcGISPro_MXDImport\ArcGISPro_MXDImport.aprx'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Set workspace&lt;BR /&gt;&lt;/SPAN&gt;arcpy.env.workspace = mxdDir&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# List the mxds&lt;BR /&gt;&lt;/SPAN&gt;mxds = arcpy.ListFiles(&lt;SPAN&gt;'*.mxd'&lt;/SPAN&gt;)&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject(proProj)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;mxd &lt;SPAN&gt;in &lt;/SPAN&gt;mxds:&lt;BR /&gt;    mxdFilePath = os.path.join(mxdDir&lt;SPAN&gt;, &lt;/SPAN&gt;mxd)&lt;BR /&gt;    aprx.importDocument(mxdFilePath)&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This was the code I used outside ArcGIS Pro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 19:35:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236541#M66198</guid>
      <dc:creator>ChrisJRoss13</dc:creator>
      <dc:date>2022-11-30T19:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Import MXD into ArcGIS Pro Project</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236558#M66199</link>
      <description>&lt;P&gt;You don't save the aprx, so when the script runs, it doesn't retain anything, I suspect.&lt;/P&gt;&lt;P&gt;When you run it within Pro it probably loads, but if you don't save the project, they will vanish as well&lt;/P&gt;&lt;P&gt;see 'save' or saveACopy in&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank"&gt;ArcGISProject—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 19:58:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236558#M66199</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-11-30T19:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Import MXD into ArcGIS Pro Project</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236561#M66200</link>
      <description>&lt;P&gt;Have you added a map to your Pro project or checked in the Catalog under 'Maps', if available? Last I knew when you bring in an *.mxd with arcpy it doesn't open a map automatically.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_1-1669838618343.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57280i0F65994186B3CA40/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaredPilbeam2_1-1669838618343.png" alt="JaredPilbeam2_1-1669838618343.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 20:03:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236561#M66200</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2022-11-30T20:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Import MXD into ArcGIS Pro Project</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236565#M66201</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;. That did the trick. For some reason I assumed I didn't have to save the project through an import. Obviously I was wrong!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 20:11:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-import-mxd-into-arcgis-pro-project/m-p/1236565#M66201</guid>
      <dc:creator>ChrisJRoss13</dc:creator>
      <dc:date>2022-11-30T20:11:50Z</dc:date>
    </item>
  </channel>
</rss>

