def newimport(modulename, *args, **kwargs):
    if modulename in beingimported:
        print('Importing in circles', modulename, args, kwargs)
print('    Import stack trace -> ', beingimported)
Detecting circular imports