<?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: Python code works in Python Window within Pro, but not in Toolbox in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-code-works-in-python-window-within-pro-but/m-p/1270794#M67070</link>
    <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/camera-class.htm" target="_blank"&gt;Camera—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It is a derived property as indicated in the help topic.&amp;nbsp; Your code snippet uses the absolute path as indicated, but you dont seem to use saveACopy as in the help topics.&amp;nbsp; Perhaps when absolute paths are used, the extent changes aren't persisted until the project is saved&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2023 10:09:39 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2023-03-23T10:09:39Z</dc:date>
    <item>
      <title>Python code works in Python Window within Pro, but not in Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-code-works-in-python-window-within-pro-but/m-p/1270743#M67068</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem when running a Python code from a toolbox. The purpose of my code is to apply definition queries to layers in an ArcGIS Pro projec (aprx), then zoom to the a specific extent using:&lt;/P&gt;&lt;P&gt;mf.camera.setExtent(new_ext)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works fine when I use the python window within ArcGIS Pro and set the ArcGIS Project to "CURRENT":&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject('CURRENT')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it does not work when I move the code to a toolbox and run it. Of course I change the ArcGIS Project from "CURRENT" to the exact Path of the aprx file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is greatly appreciated!&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Moath&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 06:34:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-code-works-in-python-window-within-pro-but/m-p/1270743#M67068</guid>
      <dc:creator>Moathmk</dc:creator>
      <dc:date>2023-03-23T06:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Python code works in Python Window within Pro, but not in Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-code-works-in-python-window-within-pro-but/m-p/1270794#M67070</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/camera-class.htm" target="_blank"&gt;Camera—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It is a derived property as indicated in the help topic.&amp;nbsp; Your code snippet uses the absolute path as indicated, but you dont seem to use saveACopy as in the help topics.&amp;nbsp; Perhaps when absolute paths are used, the extent changes aren't persisted until the project is saved&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 10:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-code-works-in-python-window-within-pro-but/m-p/1270794#M67070</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-03-23T10:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python code works in Python Window within Pro, but not in Toolbox</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-code-works-in-python-window-within-pro-but/m-p/1270827#M67072</link>
      <description>&lt;P&gt;Can you supply the rest of your code to help troubleshoot the issue?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 12:32:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-code-works-in-python-window-within-pro-but/m-p/1270827#M67072</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2023-03-23T12:32:02Z</dc:date>
    </item>
  </channel>
</rss>

