I would recommend to derive a custom class using the Densenet121 implementation as the parent class. Inside the __init__, you could try to split the self.features sequential module and create your own forward method using these splits.
Your code snippet would work for very simple models, which can be defined in an nn.Sequential module alone.