Created
July 8, 2019 23:22
-
-
Save CorradoLanera/11eb8389ca871620152f422a93787d78 to your computer and use it in GitHub Desktop.
Print the modules currently imported in a python sesson
This file contains 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
import types | |
def imports(): | |
for name, val in globals().items(): | |
if isinstance(val, types.ModuleType): | |
yield val.__name__ | |
print(list(imports())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Disclaimer
This is a copy-pasting and merging script from the ones reported in this StackOverflow answer and its comments.