I created 3 gdb's under the home project gdb and created 3 point feature classes in each respectively. How do I iterate through all the file gdb's and add fields into each of them?
@RhettZufelt is correct. You need this:
workspaces = ['path/to/workspace1','path/to/workspace2','path/to/workspace3']
That's step 1. There are more steps after that to fix your code. If you are still needing help on this, please respond and I (we) can help you.
You need a list of workspaces to iterate, in your current code, 'workspaces' is not defined.
So, set the folder that contains them to arcpy.env.workspace = "path:to/workspaces/folder", then workspaces = arcpy.ListWorkspaces("*", "FileGDB"), OR, manually make the list of workspaces.
Then, you need to move the featureclasses = arcpy.ListFeatureClasses() into the for workspace loop.
Need to set the workspace first so it can list the featureclasses in that workspace.
The rest of the code looks good.
R_
Give Add Fields a shot Add Fields (multiple) (Data Management)—ArcGIS Pro | Documentation, especially if you batch it in the GUI. (Right click, "Batch"). If you only have three (or even 9) feature classes, this is gonna be the easiest way to do it.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.