  Starting from the free field realization of Kac-Moody Lie algebra, we define
a generalized Yang-Yang function. Then for the Lie algebra of type $A_{n}$, we
derive braiding and fusion matrix by braiding the thimble from the generalized
Yang-Yang function. One can construct a knots invariant $H(K)$ from the
braiding and fusion matrix. It is an isotropy invariant and obeys a skein
relation. From them, we show that the corresponding knots invariant is HOMFLY
polynomial.
