Übersicht: Python & Blender


If the objects are created, in a second step further manipulations


  1. What is possible with lists? If in doubt, have a look at Python basics: lists
  2. Create a script that executes the code from this station.
  3. Add a new object to the scene and run the script again.

Show all objects

In an new Blender file, in a scene some objects are placed by default. How to get a list of available objects is shown with the following script:

blender-basics/b-find-information/object-list.py (Source)

Name: 'object-list.py'
Blender: 2.7x
Group: 'Discover'
Tooltip: 'Find objects in a scene'

import bpy

def get_list_of_objects():
    """ Print list of objects in a scene """

    for i in bpy.data.objects:

if __name__ == '__main__':
    # call the new function

The modul bpy.data contains as structure objects. From this you can get a list of objects of the context, the scene. A for loop is used to print all objects:


<bpy_struct, Object("Camera")>
<bpy_struct, Object("Cube")>
<bpy_struct, Object("Lamp")>
You can imagine, what sort of objects are available in the scene.

This is the output on a command line on windows.