How to export multiple objects from Blender as OBJ or FBX

- by

Blender has a handy script built-in that lets us export multiple selected objects in our scene as separate objects. I remember mentioning this principle in a beefy article focussing on Unreal Engine workflow, but thought it would be neat to turn it into its own article. Here it is!

Let’s assume we have several objects in our scene, and rather than exporting a combined version, we want separate files. Select all objects you want to export, then head over to the Scripting Tab. You’ll see a small version of your viewport, and a large empty window in the middle.

Click on Templates – Python – Batch Export and the following script will load.

Save your scene to a folder that you’d like to save your objects to, then click the little play button at the top right. Blender will go to work and export all your selected objects out as FBX files. Neat, huh?

If you prefer to export as OBJ, change line 29 of the code into the following (replacing FBX with OBJ twice):

bpy.ops.export_scene.obj(filepath=fn + ".obj", use_selection=True)

This script has changed a tad over the years, and this version works in Blender 3.0 (in fact that’s where I’ve lifted it from). Just in case you can’t find it, or something changes, here is the OBJ version in its entirety:

# exports each selected object into its own file

import bpy
import os

# export to blend file location
basedir = os.path.dirname(bpy.data.filepath)

if not basedir:
    raise Exception("Blend file is not saved")

view_layer = bpy.context.view_layer

obj_active = view_layer.objects.active
selection = bpy.context.selected_objects

bpy.ops.object.select_all(action='DESELECT')

for obj in selection:

    obj.select_set(True)

    # some exporters only use the active object
    view_layer.objects.active = obj

    name = bpy.path.clean_name(obj.name)
    fn = os.path.join(basedir, name)

    bpy.ops.export_scene.obj(filepath=fn + ".obj", use_selection=True)

    # Can be used for multiple formats
    # bpy.ops.export_scene.x3d(filepath=fn + ".x3d", use_selection=True)

    obj.select_set(False)

    print("written:", fn)


view_layer.objects.active = obj_active

for obj in selection:
    obj.select_set(True)



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site witout any pesky ads! More details here.

Add your voice