Detect holes on a not flat surface at a set circumference
You can take advantage of the fact that holes are also non-manifold to easily identify hole vertices that lie within a given radius from the selected face.



Here's the code:

import bpy, bmesh

radius = 0.5

# Assumes your object is selected and is in edit mode
o  = bpy.data.objects[ bpy.context.object.name ]
bm = bmesh.from_edit_mesh( o.data )

# Assumes you have a single face selected
fCo = bm.select_history[0].calc_center_median() # Location of face center

bpy.ops.mesh.select_all( action = 'DESELECT' )
bpy.ops.mesh.select_mode( type = 'VERT' )
bpy.ops.mesh.select_non_manifold() # Holes are also non-manifold

# Find all hole verts that are closer to the selected face than the radius
verts = [ v for v in bm.verts if v.select and ( fCo - o.matrix_world * v.co ).length &lt; radius ]

if len( verts ) &gt; 0:
    print( "%s hole verts within radius of %s blender units" % ( len( verts ), radius ) )

bpy.ops.mesh.select_all( action = 'DESELECT' )
for v in verts:
    v.select = True

bm.select_flush( True )