Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Python Basics: Modules and Packages (Summary)

Now you have the power to write programs that consist of more than a single file. You can put related code into separate files called modules and then put individual modules together like building blocks to create a larger application.

In this video course, you learned how to:

  • Create your own modules
  • Use modules in another file through the import statement
  • Organize several modules into a package

To continue on your learning journey, you can buy yourself a copy of Python Basics: A Practical Introduction to Python 3 and check out the other Python Basics courses.

Download

Course Slides (.pdf)

4.7 MB
Download

Sample Code (.zip)

651 bytes

00:00 Congratulations, you’ve made it to the last lesson of this course. In this course, you’ve learned how to create your own modules, use modules in another file via the import statement, and adjust the import statements to avoid namespace conflicts. Also, you learned how to organize several modules into a package or even a subpackage.

00:23 I also gave you two exercises and a challenge that you can do afterward.

00:28 If you want to deepen your knowledge about modules and packages even more, then I have some additional resources for you. The Python Modules and Packages: An Introduction video course and tutorial explores modules and packages even more.

00:41 You may know a thing or two mentioned there already, but hey, that’s actually a good thing because it means I did my job well. Another resource I can highly recommend is the Code Conversation that Ian and Geir Arne had on Everyday Project Packaging With pyproject.toml.

00:57 This video course will answer a few questions that you might have, and you can join them discussing the best practices of building a modern Python package.

01:06 Last but not least, there is Python import: Advanced Techniques and Tips. In this in-depth tutorial, you’ll learn how to harness the power of Python’s import system to improve the structure and maintainability of your code.

01:20 So if you haven’t gotten enough of import statements in this video course, make sure to check out this tutorial.

01:28 Okay, that’s all I’ve got for you today. Thanks again for joining me on this video course, and until next time, at realpython.com.

Become a Member to join the conversation.