How to apply my list of names to the objects?

I have a list of names for 50 objects. How can I apply those names from the list to my 50 objects at once?

All my object names are numbered from 1 to 50, so my list is like this:

1: blue small car

2: red small car

3: green small car


So I just need to replace the names with the numbers from 1-50.

Is it possible to do it with a script?

Something like this?





Code Snippet

import bpy

OBJ_NAMES = ["Red", "Green", "Blue"]

for i in range(0,3):
    for o in
        if == str(i):
   = OBJ_NAMES[i]

Thank you. yes but with 50 objects and different names, can i just past my list there and change the numbers?

Yes, of course. Just change the “3” to “50” and replace the OBJ_NAMES list with your own list and everything should work fine.

I’ll expand on @RPaladin’s answer. Another possibility, IF all your objects names map 1-1 to the indices of your names list. Otherwise it will throw an error.

We make a copy of otherwise we modify the container as we iterate over it which is prone to error.

import bpy

OBJ_NAMES = ["Red", "Green", "Blue"]

for obj in[:]: = OBJ_NAMES[int(]
1 Like