Add Field to Featureclass

735
2
05-23-2023 12:23 AM
Labels (3)
qnadeem
New Contributor II

Hi All

Just a clarification question as I could not find any reference document.

in ArcGIS Pro Python window, we have a command "arcpy.management.AddField()" and "arcpy.AddField_management()"

I just want to know what the difference in both commands and any recommendation on usage is.

in ArcGIS Pro Notebook, I get the following Help.

Signature:
arcpy.management.AddField(
    in_table=None,
    field_name=None,
    field_type=None,
    field_precision=None,
    field_scale=None,
    field_length=None,
    field_alias=None,
    field_is_nullable=None,
    field_is_required=None,
    field_domain=None,
Docstring:
AddField_management(in_table, field_name, field_type, {field_precision}, {field_scale}, {field_length}, {field_alias}, {field_is_nullable}, {field_is_required}, {field_domain})
 

 

0 Kudos
2 Replies
JoshuaSharp-Heward
Occasional Contributor III

Hi,

I'm fairly sure they are functionally the same, I think with the transition from ArcMap to ArcGIS Pro ESRI tidied up the ArcPy functions to be in the format arcpy.mapping, arcpy.management etc. but the historic versions are still around presumably for backwards compatibility? If you look at some of the older geoprocessing documentation for ArcMap you will see references to the older format of arcpy.AddField_management (see here https://desktop.arcgis.com/en/arcmap/10.6/tools/data-management-toolbox/add-field.htm). So I'd recommend using arcpy.management.AddField(), and sticking with whatever is referenced in the most recent ArcGIS Pro documentation for python snippets.

0 Kudos
qnadeem
New Contributor II

@JoshuaSharp-Heward  Thanks for clarification

0 Kudos