So far I have the code:
scene = bpy.context.scene
import_avHat1 = bpy.ops.import_scene.obj(filepath=avatarHat_1)
import_avHat2 = bpy.ops.import_scene.obj(filepath=avatarHat_2)
import_avHat3 = bpy.ops.import_scene.obj(filepath=avatarHat_3)
hats = bpy.context.selected_objects[:]
for obj in hats:
# print the name of the current obj
print (obj.name)
bpy.context.view_layer.objects.active = obj
obj_camera = bpy.context.scene.camera
scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = "~/mark/renderOutput.png"
bpy.ops.render.render(write_still = 1)
It only renders the first hat and I get no errors importing the others. What should I do? This occurs in blender 2.8.