I have a Django project which uses the blender python API.
I have a separate file with my bpy code which is called from a Django view method.
In there I create a plane and use the displacement modifier with a height map. Afterwards I want to change some things on the mesh of the plane, for that I need to go into the EDIT mode. I do that with
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.extrude_region_move()
but I get this error: RuntimeError: Operator bpy.ops.object.mode_set.poll() Context missing active object
.
I also tried it with
bpy.ops.object.editmode_toggle()
which results in this error: RuntimeError: Operator bpy.ops.mesh.extrude_region_move.poll() failed, context is incorrect
All of this is done inside with bpy.context.temp_override(**mycontext):
I compiled the bpy module myself from the github sources with the tag v3.2.2
I use python version 3.10.2