<?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 Switching between layouts in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/switching-between-layouts/m-p/1565655#M73289</link>
    <description>&lt;P&gt;I have a script that works with multiple maps and layouts in ArcGIS Pro: Map1 is associated with Layout1, Map2 with Layout2, and Map3 with Layout3. My script includes several functions, and specific functions need to be executed on specific maps and layouts.&lt;/P&gt;&lt;P&gt;One of the operations in the script uses arcpy.SelectLayerByLocation_management. I encounter an error stating that a layer does not exist. This happens because the target map or layout is not active when the function is executed.&lt;/P&gt;&lt;P&gt;Is there a way in Python to programmatically switch between maps and layouts to ensure the operations run on the correct context, even if the map or layout isn't currently active in the ArcGIS Pro interface?&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2024 16:12:23 GMT</pubDate>
    <dc:creator>TonyAlmeida</dc:creator>
    <dc:date>2024-12-06T16:12:23Z</dc:date>
    <item>
      <title>Switching between layouts</title>
      <link>https://community.esri.com/t5/python-questions/switching-between-layouts/m-p/1565655#M73289</link>
      <description>&lt;P&gt;I have a script that works with multiple maps and layouts in ArcGIS Pro: Map1 is associated with Layout1, Map2 with Layout2, and Map3 with Layout3. My script includes several functions, and specific functions need to be executed on specific maps and layouts.&lt;/P&gt;&lt;P&gt;One of the operations in the script uses arcpy.SelectLayerByLocation_management. I encounter an error stating that a layer does not exist. This happens because the target map or layout is not active when the function is executed.&lt;/P&gt;&lt;P&gt;Is there a way in Python to programmatically switch between maps and layouts to ensure the operations run on the correct context, even if the map or layout isn't currently active in the ArcGIS Pro interface?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 16:12:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/switching-between-layouts/m-p/1565655#M73289</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-12-06T16:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Switching between layouts</title>
      <link>https://community.esri.com/t5/python-questions/switching-between-layouts/m-p/1565675#M73290</link>
      <description>&lt;P&gt;If you know the names apriori, then you could use listMaps or listLayouts with the name as a filter prior to seletlayerbylocation&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;&lt;P&gt;or you could use the memory workspace for the processing and save the results if needed&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/basics/the-in-memory-workspace.htm" target="_blank"&gt;Write geoprocessing output to memory—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 16:31:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/switching-between-layouts/m-p/1565675#M73290</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-12-06T16:31:37Z</dc:date>
    </item>
  </channel>
</rss>

