# Python Script - Addon; Bmesh Clean

I've purchased an Addon called 'Bmesh Clean' which basically systematically cleans up any selected mesh.

I'm trying to write my own script that will automate a process, which will include using the Bmesh Clean function, however I have no idea how to actually call it from my script, and I keep getting 'Python script fail'.

My script is very simple currently, it just imports an FBX, selects all, and then tries to call the Bmesh Clean;

#import bpy

bpy.ops.import_scene.fbx(filepath="C:\\Users\\Work\\Desktop\\my_file.fbx")
bpy.ops.object.select_all(action='SELECT')


In the Bmesh Clean, there is a 'def bmesh_clean():'

However, I cannot figure out how to call this. Using import bmesh_clean fails, I even tried the script name as import which fails too. I assume that once I've imported it correctly, I only need to call 'bmesh_clean()' on my script.

• Since this is a paid add-on, we can't really help you here since we'd have to take a look at the source to see under which namespace the function or operator is registered and what context is required to execute it. Perhaps you can figure this out yourself by enabling Python tooltips in the preferences to see the function call behind the add-on UI and taking a look at the poll() function of the operator in question. – Robert Gützkow Dec 17 '19 at 12:46
• This needs clarification. Perhaps a small code example of import statement. For example can import the info dictionary for Magic UV addon using from magic_uv import bl_info whether the addon is registered or not. Are you using the method mentioned in question, or an operator bpy.ops.bmesh.clean (guess at name as don't have addon). To use the operator would definitely need the addon to be registered. – batFINGER Dec 17 '19 at 14:55