We consider the reflection-transmission problem in a waveguide with obstacle. At certain frequencies, for some incident waves, intensity is perfectly transmitted and the reflected field decays exponentially at infinity. In this work, we show that such reflectionless modes can be characterized as eigenfunctions of an original non-selfadjoint spectral problem. In order to select ingoing waves on one side of the obstacle and outgoing waves on the other side, we use complex scalings (or Perfectly Matched Layers) with imaginary parts of different signs. We prove that the real eigenvalues of the obtained spectrum correspond either to trapped modes (or bound states in the continuum) or to reflectionless modes. Interestingly, complex eigenvalues also contain useful information on weak reflection cases. When the geometry has certain symmetries, the new spectral problem enters the class of $mathcal{PT}$-symmetric problems.