Why not add Boolean modifiers based on selected vs active states. If you have 5 selected objects, the last one selected is active.
The concept
import bpy
def get_active_and_selected(context):
active = context.active_object
selection = context.selected_objects
selected = set(selection).difference(set([active]))
print('active:', active.name)
print('selected (not active):', [o.name for o in selected])
get_active_and_selected(bpy.context)
If the cube is selected last it will print:
active: Cube
selected (not active): ['Sphere.004', 'Sphere.002', 'Sphere.001', 'Sphere.003']
The function
Adding multiple modifiers to the active object
import bpy
def add_selected_to_active(context):
active = context.active_object
selection = context.selected_objects
selected = set(selection).difference(set([active]))
if not (active and selected):
return
for idx, cutter in enumerate(selected):
bool_mod = active.modifiers.new('cutter_' + str(idx), 'BOOLEAN')
bool_mod.operation = 'DIFFERENCE'
bool_mod.object = cutter
cutter.hide = True
add_selected_to_active(bpy.context)

The operator
This could be easily turned into an Operator and employ error checking to avoid doing anything until all necessary conditions are OK.
At this point it's worth your time to read up on operators. How to make them, register them and call them from UI. It's just a bit of boilerplate which is similar for all add-ons. Blender's TextEditor has a few Operator templates, most notably: TextEditor > Templates > Python > Operator (Simple)