Consider a topological space $X$ and a subset $Z \subset X$. Assume we are given a continuous injective map (in $X$ topology) $f:Z \to Z$ such that $g: Z \setminus C \to Z$(where $C \subset Z$) and $g\circ f = {\rm id}_Z$ is also continuous. Will $f$ and $g$ remain continuous in the induced topology, i.e. the topology induced on $Z$ by the topology of $X$?
Thank you