How to use output of one model as input of other model?

Hello everybody!
This question may sound silly, but how to use the output of one neural network as input to another? (I googled about this, but found nothing)

I don’t think there is anything special to do, you can just do

y = model1(x)
z = model2(y)

I want to connect them in such a way that output from M1 is input to M4 ← M3 is easy to do using a Merge layer in a Sequential *model.

Intuitively, you can think like below equation
y = f(x),
and then
z = g(y),
where f and g are neural networks, y is the output of the f.
You can feed the y into the g function, i.e. other model.