Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 24347

Test and Code: 222: Import within a Python package

$
0
0

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

<p>In this episode we're talking about importing part of a package into another part of the same package.</p><p><br></p><p>We'll look at: `from . import module` and `from .module import something`</p><p>and also:  `import package` to access the external API from with the package.</p><p><br></p><p>Why would we use `import package` if `from . import api` would work fine?</p> <br><p><strong> Learn pytest</strong></p><ul><li>pytest is the number one test framework for Python.</li><li>Learn the basics super fast with <a href="https://courses.pythontest.com/hello-pytest">Hello, pytest!</a></li><li>Then later you can become a pytest expert with <a href="https://courses.pythontest.com/the-complete-pytest-course">The Complete pytest Course</a></li><li>Both courses are at <a href="https://courses.pythontest.com/">courses.pythontest.com</a></li></ul>

Viewing all articles
Browse latest Browse all 24347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>