I think it would be a good idea to make a common cleanup function for all the modules that accepts a list of strings that represent the various things that should be removed when going to a different module.
Each module needs to implement the cleanup function and it does so in the most efficient way possible. Efficient cleanup is more complex than passing a list of strings, classes, attributes, etc.
I think it would be a good idea to make a common cleanup function for all the modules that accepts a list of strings that represent the various things that should be removed when going to a different module.