Error on adding layers to pretrained model

Found unexpected instance while processing input tensors for keras functional model when I use Model(pre_trained_model, x)

The code:

def create_final_model(pre_trained_model, last_output):
  # [snippet removed by mentor]
  model = Model(pre_trained_model, x)
  # [snippet removed by mentor]
  return model

When I call this function, the error comes out.

When constructing a Model instance using another model, use the inputs property. See this page.