If statement for initializing the model class seems to be ignored

I have a model:

class model(nn.Module):
       def __init__(self, ...., train=True):
             ...
             if train:
                 ....

Which inside if they produce some networks. I would like to produce two instances of the same mode:

main_model = model(...)
pivot_model = model(....,train=False)

But what I see is that even in the pivot_model I can see the networks in the if statement. This is not what I have expected.

I use the same technique often, and it definitely works on my machineā€¦ You might have a typo in the train argument on one size or the other?

I think you are right, thanks.