QuestionQ18

Modules and Packages

Regarding the directory structure below, select the correct directive forms to import module_a.

Question Image

Choose two
  • A import pypack.module_a
  • B import module_a from pypack
  • C import module_a
  • D from pypack import module_a
Explanation

module_a.py is a direct submodule of the pypack package, so it can be imported as pypack.module_a or imported by name from pypack. Python’s package import syntax supports both fully qualified imports and from package import module imports.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!