When does the complement of a hypersurface in a projective space admit a nonconstant holomorphic function?

Always. If $H=Z(f)$ with $\deg f=d$, then $\dfrac gf$ is a nonconstant holomorphic function on $\mathbb P^n\setminus H$ for any homogenous $g\neq \lambda\cdot f$ of $\deg g=d$. 

