so i have a project with 3 maps and layout, i have some code that exports the layout which uses two of the maps, the third map is used to select some features and then export it to a DXF file, this all works fine if the DXF map is selected before you run the code, if not it errors saying the DXF export can't find one of the layers
so how can i set the DXF export map as the code is ran
i've tried a few things but nothing works
m = aprx.listMaps('CAD_EXPORT') m.active() m.enabled()
Note: arcpy.mp does not provide access to map views within the application; it only provides access to MapFrames.
So I'm not sure this is possible from arcpy.mp - hopefully someone else will chime in soon.
Your solution may be to provide an error message to tell the user to select the correct map before running the tool. Better yet, do this in the parameter validation to keep the user from running the tool when the wrong map is active.
one work around would be to check the map before it ran and then give an error if its not the correct one but the user running the script would then need to notice it and not assume its ran and that there was nothing to export