1import bpy
2
3
4# print all objects
5for obj in bpy.data.objects:
6    print(obj.name)
7
8
9# print all scene names in a list
10print(bpy.data.scenes.keys())
11
12
13# remove mesh Cube
14if "Cube" in bpy.data.meshes:
15    mesh = bpy.data.meshes["Cube"]
16    print("removing mesh", mesh)
17    bpy.data.meshes.remove(mesh)
18
19
20# write images into a file next to the blend
21import os
22with open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w') as fs:
23    for image in bpy.data.images:
24        fs.write("%s %d x %d\n" % (image.filepath, image.size[0], image.size[1]))
25