How to create a .blend file (out of Blender)?

I’m trying to make an export script for other application, but I would like to export direct to Blender. How can I create a blend file out of Blender using Python?

I encountered the same problem when I tried to export a rigged character from MakeHuman to Blender. The format of a blend file is described at After some attempts one thing became very clear to me: although it is possible to write a blend file from your own application, you don’t want to. You just don’t. To write a blend exporter you more or less need to write a whole mini-blender of your own.

Instead I settled for a different strategy: I defined a custom exchange format, and wrote an exporter to this format for MakeHuman and an importer for Blender. The format I use is based on Wavefront obj, with additional constructs for armatures, vertgroups and shapekeys; depending on your needs, you may have to invent additional commands. The code can be downloaded from

How about you create an empty (or full) scene and then use the python Save api call.