# how do i replace the name of multiple objects in a list with names in another list?

I'm currently trying to create a tool, to rename objects in blender, to automatically have lowercase names. I keep however getting the error: TypeError: 'list' object is not callable

My current code is below, can anyone tell me how I can fix this error?

        objs = bpy.context.scene.objects

#o = old_name l = lowercase
o = {n.name for n in objs}
print(o)
l = [elem.lower() for elem in o]
count = len(objs)
i = 0
print(count)
while i < count:
objs[i].name = l()
i+=1


edit: I want to do more with the name than just make it lowercase, but I keep getting stuck on renaming the objects in the right order so that's what I'm trying to fix here

• Hi. l is a list. l() is trying to call the list as if it were a function, which it is not. What were hoping l() would do? – Ray Mairlot Jan 17 at 16:00
• I want l to contain the new names of the objects, and assign them as the object name using objs[i].name  – henry de lange Jan 17 at 16:06

Currently your script performs several unnecessary operations when your goal is to rename the objects.

• You're creating a set of object names by using the {} syntax, which isn't necessary since the names are guaranteed to be unique.
• Unless you intend to re-use the old names, it's not necessary to store them.
• You likely don't need to store the new lowercase names either, if you perform your action while iterating over the objects.
• Don't use a while loop when you intend to index elements. Use a for loop instead, especially if the object is iterable.
• The l is a list of strings, therefore using l() would result in a TypeError, since a list can't be called. It's not a function.

The solution would be to iterate over the objects and rename them one by one.

import bpy

for obj in bpy.context.scene.objects:
obj.name = obj.name.lower()


If you have to store the lowercase names in a list:

import bpy

names_lowercase = []

for obj in bpy.context.scene.objects:
name = obj.name.lower()
obj.name = name
names_lowercase.append(name)

• Thanks, this really helped me out – henry de lange Jan 20 at 14:09