Script to join sets of 'Linked Flat' faces

I’m trying to make a script that will run through all the faces in a mesh, select all the ‘Linked Flat’ faces, and then join them. I’m getting an error about the context right now:

bpy.context.tool_settings.mesh_select_mode=(False,False,True) #optional
for ob in
if ob.type == “MESH”: = False
m =
faces = []
for face in m.polygons: = True
bpy.ops.mesh.select_all(action = ‘DESELECT’)
bpy.ops.object.mode_set(mode = ‘EDIT’)

Any help would be greatly appreciated.

Note that this is exactly what the ‘Limited Dissolve’ tool already does. Did you try this?

Nope, that’s why I’m here in the beginner section… :frowning: But thank you very much! I will check it out! :slight_smile: