(func)
| 30 | |
| 31 | def when_imported(fullname): |
| 32 | def decorate(func): |
| 33 | if fullname in sys.modules: |
| 34 | func(sys.modules[fullname]) |
| 35 | else: |
| 36 | _post_import_hooks[fullname].append(func) |
| 37 | return func |
| 38 | return decorate |
| 39 | |
| 40 | sys.meta_path.insert(0, PostImportFinder()) |