Test and Code   /     222: Import within a Python package

Subtitle
Duration
722
Publishing date
2024-09-07 09:27
Link
https://testandcode.com/episodes/222-import-within-a-python-package
Contributors
  Brian Okken
author  
Enclosures
https://media.transistor.fm/660eafdc/0f0f91a7.mp3
audio/mpeg

Shownotes

In this episode we're talking about importing part of a package into another part of the same package.


We'll look at: `from . import module` and `from .module import something`

and also:  `import package` to access the external API from with the package.


Why would we use `import package` if `from . import api` would work fine?


 Learn pytest