I learned this from my situation. The module was not automatically imported along with the rest of the package. Prior to this experiment, I mistakenly understood that each package module is automatically imported from import x or from x import * . They do not do this.
Beginners can expect EVERYTHING to import these calls, I reckon. But the following GUI code, which is generic, demonstrates that this is not the case:
from tkinter import * from tkinter import ttk
In the above example, the ttk module ttk not automatically import along with the rest of the tkinter package, for example.
The explanation I was told about is this: when you use from x import * , you only actually import things in your-python-location/lib/x/__init__.py
Packages are folders. Modules are files. If the import calls specific files, the __init_.py package __init_.py will list specific files for import.
source share