for k, v in list(sys.modules.items()):
    if not hasattr(v, '__file__'):
        continue
if v.__file__.startswith(SYS_PREFIX):
    pass
How to make pdb recognize that the source has changed between runs?