$\varphi\colon M\to N$ continuous and open. Then $f\colon N\to P$ continuous iff $f\circ\varphi\colon M\to P$ continuous.
"Proof:" Let $A\subset P$ open then exists $U\subset M$ such that $(f\circ \varphi)[ U]=f(\varphi[U])\subset A$ where $\varphi[U]\subset N$ is open. The other side is trivial. $\square$
I think that I'm right but my book says:
$\varphi\colon M\to N$ continuous surjective and open. Then $f\colon N\to P$ continuous iff $f\circ\varphi\colon M\to P$ continuous.
I didn't use surjective property. It is necessary?
Added: According Dylan Moreland second paragraph my proof works when I'm proving for each point of $N$, then my proof is easly to fix.
Correct proof: Let $a\in N$ then for all neighborhood $V$ of $f(a)$ exists $U\subset M$ neighborhood of $\varphi^{-1}(a)\in M$ [exists by surjectivity] such that $(f\circ \varphi)[ U]=f(\varphi[U])\subset V$ where $\varphi[U]\subset N$ is a neighborhood of $a$ since $\varphi$ is open. The other side is trivial. $\square$
Added (2): I think that the fact is true if we say that $\varphi$ is close indeed open function. But the neighborhood proof doesn't work.
Added (3): I think that I have a proof for the fact that I said in Added (2) and I was put as a question $\varphi:M\to N$ continuous surjective and closed. Then $f$ continuous iff $f\circ\varphi$ continuous.