Mass replace names in vertex groups I have a character that is setup with a rig and vertex groups. I want to switch to using Rigify. Rigify has the same bones as the current setup, but different names. To save time weight painting, I need to rename all the bone weight vertex groups to match the bone names used by Rigify instead of the current rig. So I need a tool or script that will take a bone name such as lowerarm_L and rename it to Forearm.L (or whatever rigify calls it.) I can make the bone name list myself.

I will need to do this on multiple characters, so making a script out of it would be very helpful. How can this be done?
The list of vertex groups can be found in the object properties, we just need to search for the names we want and rename them.

You could fill in name_list from the start or just add one or two names as you find them and re-run the script. This is set to rename vertex groups in the active object.

import bpy

name_list = [
    # old name - new name
    ['lowerarm_L','forearm.L'],
    ['lowerarm_R','forearm.R'],
    ['upperarm_L','upper_arm.L'],
    ['upperarm_R','upper_arm.R'],
]

v_groups = bpy.context.active_object.vertex_groups
for n in name_list:
    if n[0] in v_groups:
        v_groups[n[0]].name = n[1]


Note that matching names this way is case-sensitive, for an insensitive match use -

v_groups = bpy.context.active_object.vertex_groups
for n in name_list:
    for vn in v_groups:
        if vn.name.lower() == n[0].lower():
            vn.name = n[1]