Claim. Let $\Omega$ be an open connected subset of $\mathbb C$ and $\,f:\Omega\rightarrow\mathbb{C}$ is holomorphic. If $\lvert\, f\rvert$ is a constant function, then $f$ is also a constant function.
I tried to do this like this: Suppose $f=u+iv$. Then from the fact that $\lvert f\rvert=\sqrt{u^2+v^2}$ is constant we get $$\frac{\partial\lvert f\rvert}{\partial z}=\frac{1}{2}\left(\frac{\partial \lvert f\rvert}{\partial x}+\frac{1}{i}\frac{\partial \lvert f\rvert}{\partial y}\right)=0$$ $$or,~~~2u\frac{\partial u}{\partial x}+2v\frac{\partial v}{\partial x}=0~~~and~~~2u\frac{\partial u}{\partial y}+2v\frac{\partial v}{\partial y}=0$$ But how do I proceed from here?
Also I need to know, What would happen if $\Omega$ were not connected?
Continuing your approach, you have $u^2+v^2=r^2=const.>0$ and additionally to your derivatives of that equation you have the Cauchy-Riemann PDE, so that you get a regular homogeneous 4x4 system for the partial derivatives of $u$ and $v$, rendering them all zero.
$$\begin{bmatrix} u&v&0&0\\ 0&0&u&v\\ 1&0&0&-1\\ 0&1&1&0 \end{bmatrix} \cdot \begin{bmatrix} ∂_xu\\∂_xv\\∂_yu\\∂_yv \end{bmatrix}=0 $$