Using python to scale/resize a selected groups of faces with individual origin
Hi you should move back them into first position.
I answered based on this question

import bpy
import bmesh

context = bpy.context


ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
scale_factor = 0.5

for face in bm.select_history:
        center = face.calc_center_median()
        for v in face.verts:
            v.co = center + scale_factor * (v.co - center)

bmesh.update_edit_mesh(me)