Skip to content

Instantly share code, notes, and snippets.

@CorradoLanera
Created July 8, 2019 23:22
Show Gist options
  • Save CorradoLanera/11eb8389ca871620152f422a93787d78 to your computer and use it in GitHub Desktop.
Save CorradoLanera/11eb8389ca871620152f422a93787d78 to your computer and use it in GitHub Desktop.
Print the modules currently imported in a python sesson
import types
def imports():
for name, val in globals().items():
if isinstance(val, types.ModuleType):
yield val.__name__
print(list(imports()))
@CorradoLanera
Copy link
Author

Disclaimer

This is a copy-pasting and merging script from the ones reported in this StackOverflow answer and its comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment