Originals from: "Toby Dickenson" http://tarind.com/depgraph.html Generate python module dependency graphs using dot (graphviz package) $ py2depgraph.py path/to/my/script.py | depgraph2dot.py | dot -T png -o depgraph.png I added some code to also save the path of any modules, so it would be easier to only print modules with particular paths, or to make the boundary between python and other languages more clear. Now the default is to only print modules I wrote or those involving comedi, print shared extension modules in blue, and the shared libraries in green.