Skip to content

Instantly share code, notes, and snippets.

@SEJeff SEJeff/
Last active Apr 11, 2019

What would you like to do?
Print every python import for debugging import issues
# Courtesy of
import sys
import builtins
except ImportError:
# py2
import __builtin__ as builtins
old_import = builtins.__import__
def my_import(name, *args, **kwargs):
if name not in sys.modules:
print('importing --> {}'.format(name))
return old_import(name, *args, **kwargs)
builtins.__import__ = my_import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.