if not bpy.ops.export_mesh.stl.poll(): raise Exception("STL export operator is not available. Ensure the STL add-on is enabled.") bpy.ops.export_mesh.stl(filepath=filepath, use_selection=True) ...