A boolean modifier that was working is now throwing an error in Blender 4.0.1
raise ValueError("1-2 args execution context is supported")
bpy.context.view_layer.objects.active = bpy.data.objects['resX']
context = bpy.context
scene = context.scene
resX = scene.objects.get("resX")
resCut = scene.objects.get("resCut")
if resX and resCut:
bool = resX.modifiers.new(name='bool', type='BOOLEAN')
bool.object = resCut
bool.operation = 'DIFFERENCE'
bpy.ops.object.modifier_apply(
{"object": resX},
modifier=bool.name)
Error throws at the 3rd from last line: bpy.ops.object.modifier_apply
So the boolean is activated, set to Difference, but throws an error during the apply function from what I can tell. I cannot as of yet look into this via the Blender documentation due to the servers being down.