Wish spell, some dm special mythic spell,
Divine curse, possibly Fey bargain , Fey gets Thier Soul and becomes mortal they become Fey intelligent weapon. Contract with a devil, options are wide once you allow god, archdevil's, other outsiders or 9th level magic. Maybe with mythic soul jar if the body dies you become bound to the object your soul is in till it is destroyed.