title: how i can subdivide object with blender python , i get error object mode to edit mode (Operator bpy.ops.object.mode_set.poll() failed,)
body: <pre><code>import bpy
   
  file_loc = 'mm_frame.obj'
   
  
  imported_object = bpy.ops.import_scene.obj(filepath=file_loc)
  obj_object = bpy.context.selected_objects[0] ####&lt;--Fix
  
  bpy.ops.object.mode_set(mode=&quot;EDIT&quot;)
  bpy.ops.mesh.subdivide(number_cuts=2)
  bpy.ops.object.mode_set(mode=&quot;OBJECT&quot;)
  
  bpy.data.objects['Cube'].select_set(True)
  bpy.ops.object.delete()
  imported_object = bpy.ops.import_scene.obj(filepath=file_loc)
  
  bpy.ops.object.mode_set(mode=&quot;EDIT&quot;)
  bpy.ops.mesh.subdivide(number_cuts=2)
  bpy.ops.export_scene.obj(filepath=&quot;zetaxh.obj&quot;)
  </code></pre>
  <p>cant subdivide this please help me.
  i need subdivide faces of object in python but i cant to go object mode to edit mode
  i need help please</p>