Created
          November 1, 2016 10:59 
        
      - 
      
- 
        Save aleneum/3f92684e3395bde2d7f99b57938563c9 to your computer and use it in GitHub Desktop. 
    Unloads all module related imports from current python session
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # unloads all imports from a certain module | |
| def unload_module(name): | |
| dk = [] | |
| for k in sys.modules.keys(): | |
| if k.startswith(name): | |
| dk.append(k) | |
| for k in dk: | |
| del sys.modules[k] | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment