How to extend an existing model

You can create the def function that will choose either of two models depending on the argument (e.g. you put the if-statement inside that function)

def F(parameter):
  with pm.Model() as model:
    ...
  if (parameter):
    with model:
      ...
  else:
    with model:
      ...
  ...
  return model