Hi,
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:
mf.camera.setExtent(new_ext)
The code works fine when I use the python window within ArcGIS Pro and set the ArcGIS Project to "CURRENT":
aprx = arcpy.mp.ArcGISProject('CURRENT')
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.
Your help is greatly appreciated!
Regards,
Moath
Camera—ArcGIS Pro | Documentation
It is a derived property as indicated in the help topic. Your code snippet uses the absolute path as indicated, but you dont seem to use saveACopy as in the help topics. Perhaps when absolute paths are used, the extent changes aren't persisted until the project is saved
Can you supply the rest of your code to help troubleshoot the issue?