RollbackImporter.
RollbackImporter instances install themselves as a proxy for the built-in __import__ function that lies behind the ‘import’ statement. Once installed, they note all imported modules, and when uninstalled, they delete those modules from the system module list; this ensures that the modules will be freshly loaded from their source code when next imported.
self.rollbackImporter = RollbackImporter() # import some modules
Module author: Bastian Venthur <venthur@cs.tu-berlin.de>