it's not going to win any beauty contests, but it'll work (underlying premise is that everything before the _ in your fc names matches in each fgdb).
import arcpy
import os
#not a fan of stating the obvious, but change the paths below to your fgdbs
#also keep the r then surround the path in quotes
#fgdb of features being clipped
source_fgdb = r'D:\a.gdb'
#fgdb of features doing the clipping
clipping_fgdb = r'D:\b.gdb'
#preferably empy fgdb to put outputs
output_fgdb = r'D:\c.gdb'
#list all the feature classes
arcpy.env.workspace = source_fgdb
source_fcs = arcpy.ListFeatureClasses()
arcpy.env.workspace = clipping_fgdb
clipping_fcs = arcpy.ListFeatureClasses()
#make a dictionary of source fc path
#to clipping fc and source name
#NB relies on names before the '_' being equal
source_clip_fc_dict = {}
for source_fc in source_fcs:
for clipping_fc in clipping_fcs:
if source_fc.split("_")[0] == clipping_fc.split("_")[0]:
source_fc_path = os.path.join(source_fgdb, source_fc)
clipping_fc_path = os.path.join(clipping_fgdb, clipping_fc)
source_clip_fc_dict[source_fc_path] = [clipping_fc_path, source_fc]
#clip each source feature and output to output_fgdb
for source_fc_path in source_clip_fc_dict:
clipping_fc_path = source_clip_fc_dict[source_fc_path][0]
source_fc_name = source_clip_fc_dict[source_fc_path][1]
out_fc_name = source_fc_name + "_Clip"
out_fc_path = os.path.join(output_fgdb, out_fc_name)
arcpy.Clip_analysis(source_fc_path, clipping_fc_path, out_fc_path)