Python Forum

Full Version: Packages and Modules
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Viewer,

import my_lib
import my_lib.my_sound
When I checked locals() listing, I do not see any difference. How does python know that I have imported a sub-package under my_lib.

Thanks,
Kiran.
(Mar-01-2018, 12:30 PM)grkiran2011 Wrote: [ -> ]How does python know that I have imported a sub-package under my_lib.
A new module instance is stored at address sys.modules['my_lib.my_sound']. The subpackage's code has been run in the module's __dict__ dictionary.