Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Packages and Modules
#1
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.
Reply
#2
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing Modules / packages Oshadha 1 1,701 Feb-05-2021, 08:04 PM
Last Post: Jeff900
  Conversion of Oracle PL/SQL(packages, functions, procedures) to python modules. DivyaKumar 2 6,489 Jul-09-2020, 04:46 PM
Last Post: srikanth7482
  Modules issue, pip3 download modules only to pyhton3.5.2 not the latest 3.6.1 bmohanraj91 6 8,432 May-25-2017, 08:15 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020