import os import bpy # put the location to the folder where the objs are located here in this fashion # this line will only work on windows ie C:\objects path_to_obj_dir = os.path.join('F:\\', 'test') # get list of all files in directory file_list = sorted(os.listdir(path_to_obj_dir)) # get a list of files ending in 'obj' obj_list = [item for item in file_list if item.endswith('.lwo')] # loop through the strings in obj_list and add the files to the scene for item in obj_list: path_to_file = os.path.join(path_to_obj_dir, item) bpy.ops.import_scene.lwo(filepath = path_to_file)