import bpy for object in bpy.data.objects: object.asset_generate_preview() bpy.ops.wm.previews_ensure()