The last state of my unsuccessful attempts has been the attached code sample.
obj = bpy.context.edit_object me = obj.data bm = bmesh.from_edit_mesh(me) bm.faces.ensure_lookup_table() for face in bm.faces: face.select_set(True) if bpy.ops.uv.smart_project.poll(): bpy.ops.uv.smart_project() face.select_set(False) bmesh.update_edit_mesh(me, True)
This will lead to an error "ReferenceError: BMesh data of type BMFace has been removed". Replacing
bpy.ops.mesh.select_all(action = 'DESELECT')
leads to a Blender crash.