Here are are some Python scripts that could accomplish your goal, although I dislike being forced into using a programming language unless I need to do something complicated or repetitively.
In the following there may be some nuance as to how you select the objects to apply modifiers.
The simplest is to look at all objects, and apply the modifier if the object has the modifier of Subdivision:
import bpy
for obj in bpy.context.editable_objects:
if "Subdivision" in obj.modifiers:
print("modifier_apply: ",obj)
bpy.context.view_layer.objects.active = obj
bpy.ops.object.modifier_apply(modifier="Subdivision")
Or, let’s say they all have a common name like "My.Subd.*", so perhaps:
import bpy
bpy.ops.object.select_all( action='DESELECT' )
# get a list of objects with a name pattern
bpy.ops.object.select_pattern(pattern="My.Subd.*")
objs = bpy.context.selected_objects
print("objects are: ", objs)
bpy.ops.object.select_all( action='DESELECT' )
for obj in objs:
print("modifier_apply: ",obj)
bpy.context.view_layer.objects.active = obj # set active object
bpy.ops.object.modifier_apply(modifier="Subdivision") # apply only a type of modifier
Or, perhaps you have linked all to a named Collection and can enumerate with:
objs = bpy.data.collections['Collection_subdiv'].objects