Detect and fix holes in an object (not mesh holes) I have a complex mesh that I have imported from a .obj file. I would like to check whether it is genus-0, i.e. whether there are any holes in the object. If there are such holes I need to fix them. I have tried searching by eye but it appears there must be rather small holes that are not obvious on inspection.

When I search for things like "Blender fill holes" the results appear to relate to holes in the mesh itself, i.e. involving edges that only have a single adjacent face. This is not what I am trying to do. For example, the standard mesh "Torus" has no holes in its mesh, but it has a big hole in the object itself, which is the kind of thing that I need to be able to fix.
Assuming you do have a closed, clean, manifold surface, and you're looking for the number of genuine topological holes, you could use the surface's Euler Characteristic? (You'd better get Math SE to check me up on that one) .. anyway...

Object mode, select the object, run this snippet..

import bpy

ob = bpy.context.object
me = ob.data
v = len(me.vertices)
e = len(me.edges) 
f = len (me.polygons)
g =  1 - ((v - e + f)/2)

print(g)


.. and the genus is returned in g.