I was wondering if anyone knows a simple python command that allows me to rename the selected group. I am working on a script that requires a renaming mid operator. I found one to rename the selected objects but not a group specifically.
Object.users_group returns a list of all groups the object is assigned to. Decide which group of the list you'd like to rename and assign a new name to
obj = bpy.context.object
obj_group = next(iter(obj.users_group), None)
grp = bpy.data.groups.get(obj_group.name)
grp.name += "_special"