Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to rename a large number of items. Doing so manually could take quite some time. I want to use python to rename the object. To find out the python command for renaming I renamed an object manually and looked in the console for the echoed command. The command was:


This command does not seem to be the correct command for renaming. It does not even contain the new name in the command. I also tried to look up the python command reference for the name, but the link was a dead end.

How can I rename an object using python?

share|improve this question
up vote 7 down vote accepted

You can access them by iterating and assign the name property:

import bpy

for obj in bpy.context.selected_objects: = "newName"

Blender automatically add .001, .002 and so on to newName if another datablock of same type and name already exists. You may need to check a name pattern within the for-loop.

Another example - rename all Mesh objects in current scene that start with C (e.g. Cube, case insensitive):

for obj in bpy.context.scene.objects:
    if obj.type == 'MESH' and"c") = "newName"
share|improve this answer
could you add the command for the selected objects? – Vader Feb 28 '14 at 19:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.