How to center a non-symmetrical object on the X axis xith a python script?
you have to find the extreme values on x axis and calculate where should be the center :

import bpy

obj = bpy.context.object
max = -9999
min = 9999
for i in obj.data.vertices :
    if i.co[0] &gt; max :
        max_ind = i.index
        max  = i.co[0]
    if i.co[0] &lt; min :
        min_ind = i.index
        min  = i.co[0]

shift = (max-min)/2 - max
obj.location[0] +=shift