No, it is not essential. Maybe I express incorrect. If you want to define two autoencoders then you need to define two encoder and two decoders (each autoencoder has one encoder and one decoder). You can do it either by defining an autoencoder class or separate classes for encoder decoder (see my example above Correct way to define two encoder modules). Then each autoencoder is a different instance. In your previous example:
#first autoencoder
encoder1=encoder()
decoder1=decoder()
parameters=[for p in encoder1.parameters()]+[for p in decoder1.parameters()]#this is given to an optimizer to perform stochastic optimization

#second autoencoder
encoder2=encoder()
decoder2=decoder()
parameters+=[for p in encoder2.parameters()]
parameters+=[for p in decoder2.parameters()]#this is given to an optimizer to perform stochastic optimization



Note that if the autoencoders does not share parameters and you want the same stochastic optimization hyperparameters you can use the same optimizer to optimize everything (as long as you sum up the cost for both of them)