For line/contour integrals (real and complex), independence of paths applies for functions that are analytic in a simply connected region . This idea comes from the respective fundamental theorems of line and contour integrals.
Note that a key implication of this is that an integral over a closed contour is equal to zero. This is especially relevant in electrostatics, where this holds true for vector fields that are conservative/irrotational.