Bookkeeping/Initialization in python scripts


I’m new to blender and sorry for some stupid questions… I searched the forum before posting this thread but found nothing…

I already know how to create and manipulate object and scenes using python ,… and I’m having some problem runing the script in blender background (blender --background --python

Do I need to do any bookkeeping/ initialization before my actual script kicks in? And does starting scene also contains one mesh cube, one light and one camera if I run my script in blender background, just like the starting scene using blender GUI?

Do I need to any clean up after I finish rendering?



one thing you can do is let your script show what your scene contains:
meshes = [ for el in if el.type == “MESH”]
print(meshes) # to some file …

You can change the startup file , fill your View3D with needed objects and use Ctrl-U (or via the File menu) …