I have two geodatabases with several feature classes in both of them. I want to spatial join the feature classes in gdb1 to those in gdb2. I tried to use "arcpy.ListFeatureClasses()" function, but it needs to set the workspace to one gdb to get its list. Here is what I wrote:
import os import pandas as pd import arcpy #set workspace as gdb1 and get its list arcpy.env.workspace = r'P:\Jung\Brownfield\=2020\Parcels_poly_scag.gdb' FC_list = arcpy.ListFeatureClasses() #set workspace as gdb2 and get its list arcpy.env.workspace = r'P:\Jung\Brownfield\=2020\Superfund_Brownfield_Database_2020.gdb' ds_list = arcpy.ListFeatureClasses() for i in ds_list: target_ft = i for j in FC_list: join_ft = j arcpy.SpatialJoin_analysis(target_ft, join_ft, target_ft + '_' + join_ft, 'JOIN_ONE_TO_ONE') And I got the error -
ERROR 000732: Target Features: Dataset SF_Active_Site_Inventory does not exist or is not supported.
It seems when I changed the workspace, the feature list of the former workspace expired.
How can I solve this problem?