Suppose the two holes are two small disks. Then connect their boundaries by a cylinder (homeomorphic copy of $[0,1]\times S^1$) lying out of the plane. Let us also add the complex $\infty$ to the space (meaning: let us start with the Riemann sphere in the place of complex plane). The resulting space is homeomorphic to the torus, so its fundamental group is $Z$, the integers. Any given closed path $p$ should belong to the homotopy class $n\in Z$ if and only if the total oriented number of passages of $p$ through the cylinder is $n$; I suppose this can be obvious from some particular way how the homotopy group can be calculated (but I am not strong at this presumably ?basic exercises). Your curve is to be completed to closed curve p_1 by one passage through the cylinder. The real segment is to be completed to a closed curve p_2 also by one passage through cylinder. So p_1 and p_2 are homotopic. It seems to me "obvious" that the homotopy does not do anything serious in the cylinder and can be modified to live in your complex domain (asside from trivial part that trivially transits between added parts of p_1 and p_2). I admit this "obvious" thing might require a substantial use of algebraic geometry or real analysis.
Now, the $\infty$ I added plays no role: The homotopy intersect the complex plain in a bounded region, it never reaches $\infty$.
(If one of your 'holes' is two disks itself, say $B(0,1/9) \cup B(i,1/9)$, then the curve might be non-homotopic to the segment. E.g. if it passes around above B(i,1/9) or winds it.)