I can’t find the error. I used your code to create CustomNet and passing an instance of your DenseNet121 to it and it works without an error.
Could you post a small executable code snippet to reproduce the error?