def SetSegmentType(segea, segtype):
    seg = idaapi.getseg(segea)

    if not seg:
        return False

    seg.type = segtype
    return seg.update()
Set segment type
dataset/ETHPy150Open EiNSTeiN-/idapython/python/idc.py/SetSegmentType