select several objects inside blender and export them all as seperate .obj?

I am currently working on a huge scene with modular building blocks and for the moment I have to export one object at the time which is extremely time consuming. Is it any way to select say 30 objects inside Blender and use the .obj exporter/some kind of script to export each object separate instead?

if you want to import them to another blend scene then you can use “append” found under “file”.

Thanks but i just want to export them as obj. I got an answer from another forum i will post it here if someone else has issues with this. Haven’t tried it out yet but hopefully it will work. You should be able to change all options after your liking.

CODE:

import bpy
import os

folder = ‘/home/zeffii/Uploads/’

selected = bpy.context.selected_objects.copy()
bpy.ops.object.select_all(action=‘DESELECT’)

for obj in selected:
name = obj.name.replace(‘.’, ‘_’)
obj.select = True
fullpath = os.path.join(folder, name + ‘.obj’)
bpy.ops.export_scene.obj(
filepath=fullpath,
check_existing=True,
axis_forward=‘-Z’,
axis_up=‘Y’,
use_selection=True,
use_animation=False,
use_mesh_modifiers=True,
use_edges=True,
use_smooth_groups=True,
use_smooth_groups_bitflags=False,
use_normals=True,
use_uvs=True,
use_materials=True,
use_triangles=False,
use_nurbs=False,
use_vertex_groups=False,
use_blen_objects=True,
group_by_object=False,
group_by_material=False,
keep_vertex_order=False,
global_scale=1,
path_mode=‘AUTO’)
obj.select = False

That way it even works…

import bpy
import os
# Blender 2.8+
folder = "/put full path to target directory here/"

selected = bpy.context.selected_objects.copy()
bpy.ops.object.select_all(action="DESELECT")

for obj in selected:
    name = obj.name.replace(".", "_")
    bpy.context.active_object.select_set(state=True)
    fullpath = os.path.join(folder, name + ".obj")
    bpy.ops.export_scene.obj(
    filepath=fullpath,
    check_existing=True,
    axis_forward="-Z",
    axis_up="Y",
    use_selection=True,
    use_animation=False,
    use_mesh_modifiers=True,
    use_edges=True,
    use_smooth_groups=True,
    use_smooth_groups_bitflags=False,
    use_normals=True,
    use_uvs=True,
    use_materials=True,
    use_triangles=False,
    use_nurbs=False,
    use_vertex_groups=False,
    use_blen_objects=True,
    group_by_object=False,
    group_by_material=False,
    keep_vertex_order=False,
    global_scale=1,
    path_mode="AUTO")
    bpy.context.active_object.select_set(state=False)