In my understanding, random variable is a measurable function from a probability space to a measurable space. Suppose $X$ is a random variable from $(A, \sigma_{A},P_A)$ to $(B,\sigma_{B})$. And $Y$ is a random variable from $(B, \sigma_{B}, P_B)$ to $(C, \sigma_{C})$.

Then $Y(X)$ is a random variable from $A$ to $C$. The problem is here, in the space $B$, we can induce probability from $A$ by random variable $X$, s.t., $P_{B}'(I) = P_A(X^{-1}(I))$. Also, random variable $Y$ use the probability measure $P_B$, then if we want to calculate the probability distribution of $Y(X)$, what probability should be used, $P_B'$ or $P_B$, or both?