I'd like to automate files creation for short films production. I'm making the film storyboard with the storypencil add-on. For those who aren't familiar you're in a video sequence editor, where you're editing multiple scenes. In my case a shot = a blender scene. each blender scene is name with this pattern: sequence-number_scene-number_shot-number. It's like: 001_001_001 (sequence 1, scene 1, shot 1) 001_001_002 (sequence 1, scene 1, shot 2) 001_002_001 (sequence 1, scene 2, shot 1).

Once the storyboard is finished, I'd like to make a script that create a file for each blender scene in the storyboard file and set automatically file name, frame start, frame end, and render folder.

I'm starting with this:

import bpy
import os

filepath = bpy.data.filepath
directory = os.path.dirname(filepath)

#set path to storyboard file
sbfile = directory+"/storyboard_script.blend"

with bpy.data.libraries.load(sbfile) as (data_from, data_to):
    scenesData = data_from.scenes
    print (scenesData)
    for sc in scenesData:
        print (sc)

From here I can get file name only. I don't manage to get other info. I tried

print (sc.frame_start)

and get this error: "AttributeError: 'str' object has no attribute 'frame_start'" I'm only getting a list of the scene name, but not other scene datas I need.

  • $\begingroup$ the libraries.load api only allows you to read datablock names and append them to the data_to in order to tell Blender which to load. So you can't read datablock properties. You may want to investigate a tool like this: projects.blender.org/blender/blender-asset-tracer also related: How can I read the properties of a node group in a blend file? $\endgroup$ Jan 26 at 12:11
  • $\begingroup$ I believe having multiple scenes in a single file is the intended functionality for this. Bpy cannot interact with files that are not open well. I would recommend reconsidering this workflow. You can have different assets in different files and link them to your scenes in a single file. Might be better to do things the way they are done. Lots of functionality for working this way exists and will make your life easier. I believe you can get Blender's open movie production files if you pay for subscription. You could explore how they do it. studio.blender.org/films $\endgroup$ Jan 26 at 12:12
  • $\begingroup$ You'll need to open each file individually and tweak the scene data there $\endgroup$
    – Gorgious
    Jan 26 at 15:27
  • $\begingroup$ Markus, Martynas, Gorgious, Thank you all for your time and answer. I don't need to link any asset at the moment. I manage to do the work by exporting data from the storyboard file, then use this csv data in an empty blend file to create all the files I need. $\endgroup$
    – adrien
    Feb 1 at 7:33

1 Answer 1


I manage to do the work by adding some step

  • Draw the storyboard, 1 blender scene per shot
  • export data in a csv file from the storyboard file
  • open an empty file the launch a script that use the csv file to create all the files I need

storyboard script:

import bpy
import os
from pathlib import Path
import csv


filepath = bpy.data.filepath
directory = os.path.dirname(filepath)

scriptsFolder = directory+"/scripts/"

if not os.path.exists(scriptsFolder):

#create csv file
datafile = scriptsFolder+"film_data.csv"

#store scenes data
scenes_list = bpy.data.scenes

#for sc in scenes_list:
#    if sc.name != "Scene" and sc.name != "Template":
#        print(sc.name)
#        print(sc.frame_start)
#        print(sc.frame_end)

#write csv file
with open (datafile, 'w', newline='') as dataf:
    writer = csv.writer(dataf)
    for sc in scenes_list:
        if sc.name != "Scene" and sc.name != "Template":
            writer = csv.writer(dataf)

csv test file

import bpy
import os
from pathlib import Path
import csv


filepath = bpy.data.filepath
directory = os.path.dirname(filepath)

filmID = "monFilm"
filmXres = 1920
filmYres = 1080
filmFrameRate = 24

#working step ws
ws1= "animation"
ws2= "compositing"

filmLocation = "/home/xxxxxxx/projets/film_pipeline/"
animationFilesFolder = filmLocation+ws1+"/"
compositingFilesFolder = filmLocation+ws2+"/"
scriptsFolder = filmLocation+"scripts/"
rendersFolder = filmLocation+"renders/"
renderAnimFolder = rendersFolder+ws1+"/"
renderCompFolder = rendersFolder+ws2+"/"

# create animation, compositing and scripts folder
if not os.path.exists(animationFilesFolder):
if not os.path.exists(compositingFilesFolder):
if not os.path.exists(scriptsFolder):
if not os.path.exists(rendersFolder):
if not os.path.exists(rendersFolder):
if not os.path.exists(rendersFolder):

#set scene data
bpy.data.scenes["Scene"].render.resolution_x = filmXres
bpy.data.scenes["Scene"].render.resolution_y = filmXres
bpy.data.scenes["Scene"].render.fps = filmFrameRate 

#use csv to create files
tab =[]

def set_up_files (workingstep, rs1, rs2, rs3, rs4,ws):
    with open(directory+'/scripts/film_data.csv',newline='') as fdata:
        reader = csv.reader(fdata,delimiter=',')
        i = 0
        for row in reader:
            bpy.data.scenes["Scene"].frame_start = int(tab[i][1])
            bpy.data.scenes["Scene"].frame_end = int(tab[i][2])
            fileName= filmID+"_"+workingstep+"_"+str(tab[i][0])+"_01"
            bpy.data.scenes["Scene"].render.filepath = "//renders/"+workingstep+"/"+str(fileName)+"/"+str(fileName)+"_"
            bpy.context.scene.render.image_settings.file_format = rs1
            bpy.context.scene.render.image_settings.color_depth = rs2
            bpy.context.scene.render.image_settings.exr_codec = rs3
            bpy.context.scene.render.image_settings.color_mode = rs4
            bpy.context.window.workspace = bpy.data.workspaces[ws]
            i +=1

set_up_files(ws1, 'OPEN_EXR_MULTILAYER', '32', 'DWAA', 'RGBA', 'Layout')

set_up_files(ws2, 'OPEN_EXR', '32', 'DWAA', 'RGB', 'Compositing')

bpy.context.window.workspace = bpy.data.workspaces['Scripting']



I'm sure it could be improve a lot but as the beginner this the best I can do at the moment.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .