Hi,
When I iterate through many feature classes of a GDB to calculate their geometry, all these feature classes are being added to current project map as layers.
I use the following script to calculate geometry.
arcpy.management.CalculateGeometryAttributes(in_features=fc, geometry_property=[["Length_ft", "LENGTH_GEODESIC"]],length_unit='FEET_US')
How to force the processing tool NOT to add the layers to map?
on a general basis
If running from notebooks or the python window, you can control it from environment settings see
env—ArcGIS Pro | Documentation
EnvManager—ArcGIS Pro | Documentation
current_setting = arcpy.env.addOutputsToMap
arcpy.env.addOutputsToMap = False
# your code
arcpy.env.addOutputsToMap = current_setting