Smart UV Project Multiple Objects to Different UV Maps I know there isn't natively in Blender a way to Smart UV Project multiple objects to their own UV Maps without doing it manually for every object but I bet it's possible using a script. However I couldn't find it anywhere and can't really code it myself. Could anyone help with the right script?
I've come up with something like this but it unwraps everything into one UV Map. I know that's because of the fact that Smart UV Project works for all selected objects, not only for active object but that's all I was able to think of.

import bpy

selection = bpy.context.selected_objects

for o in selection:
    bpy.context.view_layer.objects.active = o
    bpy.ops.uv.smart_project()
Here's the working code, thanks to batFINGER:

import bpy

selection = bpy.context.selected_objects
bpy.ops.object.select_all(action='DESELECT')

for o in selection:
    o.select_set(True)
    bpy.context.view_layer.objects.active = o
    bpy.ops.uv.smart_project()
    o.select_set(False)