import arcpy def numberStringFieldsWithLayer(layer = None): # If no layer is passed in, stop the function if layer == None: return None # Get the count for each field with type "String" n = 0 for field in arcpy.ListFields(layer): if field.type == "String": n += 1 return n
# Add your custom module folder to the system paths import sys sys.path.append(r"Path\to\your\custom\module\folder") # import your custom moudle import customModule # Make a layer object from your feature layer streetsLayer = arcpy.mapping.Layer("streets") # Call you custom function from the module numberOfFieldsTypeString = customModule.numberStringFieldsWithLayer(streetsLayer) # Remove your layer reference del streetsLayer # Print your results print numberOfFieldsTypeString
Here's a very simple way to call another script (there are many other ways):
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.