I am creating a tool in ArcGIS Pro where a part of the code creates a feature class (low_fuel_warning) and adds fields to it. When running the code in the Jupyter Notebook in ArcGIS, it works as it should. However, when running the code in a tool, it only creates a feature class but fails to add any fields.
What could the reason behind this be?
workspace = path to workspace
# Create feature class low_fuel_warning
low_fuel_warning = arcpy.CreateFeatureclass_management(out_path=workspace, out_name="low_fuel_warning", geometry_type="POINT", template=[], has_m="DISABLED", has_z="DISABLED", spatial_reference="", config_keyword="", spatial_grid_1=0, spatial_grid_2=0, spatial_grid_3=0, out_alias="")
# Add field "fuel level", "distance", and "origin" to feature class
low_fuel_warning = arcpy.AddField_management(in_table="low_fuel_warning", field_name="fuel_level", field_type="DOUBLE", field_precision=None, field_scale=None, field_length=None, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")
low_fuel_warning = arcpy.AddField_management(in_table="low_fuel_warning", field_name="distance", field_type="DOUBLE", field_precision=None, field_scale=None, field_length=None, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")
low_fuel_warning = arcpy.AddField_management(in_table="low_fuel_warning", field_name="origin", field_type="TEXT", field_precision=None, field_scale=None, field_length=None, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")[0]