Apply modifier button will write this into the console:
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Box Right ")
Adding this line after "bool_mod.object = obj" does not work as expected stating that object has not attribute 'modifier'
ERROR:
File "C:\Users\info\Desktop\Boolean.blend\ui_panel_simple.py", line 38, in execute
AttributeError: 'Object' object has no attribute 'modifier_apply'
CODE:
def execute(self, context):
target_obj = bpy.context.active_object
tool_objs = [obj for obj in bpy.context.selected_objects if obj != target_obj]
for obj in tool_objs:
bool_mod = target_obj.modifiers.new(obj.name+' ', 'BOOLEAN')
bool_mod.operation = 'DIFFERENCE'
bool_mod.object = obj
target_obj.modifier_apply(modifier=bool_mod.name)
I went to blender python website to read about the modifier command and values and to my surprise found nothing that explains what options there are for operation for example.
https://www.blender.org/api/blender_python_api_2_70_5/bpy.types.Modifier.html