I am trying to use bpy.ops
for things like separating meshes, changing bpy.context.mode
, adding modifiers and deleting meshes. However, I am unsure how to change which object bpy.ops
operates on.
Here is my code
object.select_set(True)
bpy.ops.object.delete()
I have heard to avoid bpy.ops
but I do not know any alternatives to my usages of bpy.ops
so any suggestions on alternatives would be appreciated.
Thank You!
bpy.data.objects.remove(obj)
for this specific usecase. However in general what you are looking for is an operator override. I set out to create a list of them out there maybe it will be of some help blender.stackexchange.com/questions/248274/… $\endgroup$