Attribute Not Added To Module After Importing
I've made the following lab: vagrant@ubuntu-xenial:~/test$ tree . ├── pack1 │ ├── __init__.py │ ├── mod1.py │ └── pack2 │ ├─
Solution 1:
A module is added as an attribute of its package when its import finishes. (Note that this can interfere with circular relative imports.) Here, pack2
immediately imports mod2
, so (regardless of further completed imports like that of mod3
) it doesn’t appear in the pack1
dictionary during mod2
’s execution.
Post a Comment for "Attribute Not Added To Module After Importing"