A better way to write it would be:
learnable_params = list(model1.parameters()) + list(model2.parameters())
if condition is True:
    learnable_params += list(model3.parameters())

optimizer = optim.Adam(learnable_params, lr=0.001, betas=(0.9, 0.999))

The idea is, not to repeat the same code (or) parameters twice. They are bound to copy-paste errors.