Created
April 12, 2014 10:54
-
-
Save robintw/10529839 to your computer and use it in GitHub Desktop.
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
from modulefinder import ModuleFinder | |
f = ModuleFinder() | |
# Run the main script | |
f.run_script('run.py') | |
# Get names of all the imported modules | |
names = list(f.modules.keys()) | |
# Get a sorted list of the root modules imported | |
basemods = sorted(set([name.split('.')[0] for name in names])) | |
# Print it nicely | |
print "\n".join(basemods) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment