Absolute vs Relative Imports in Python

If you’ve worked on a Python project that has more than one file, chances are you’ve had to use an import statement before. Even for Pythonistas with a couple of projects under their belt, imports can be confusing!

If you’re reading this because you’d like to gain a deeper understanding of imports in Python, particularly absolute and relative imports, then you’ve come to the right place! In this tutorial, you’ll learn the differences between the two, as well as their pros and cons.

About Joe Tatusko

Joe Tatusko Joe Tatusko

Joe is a manufacturing engineer turned Pythonista with interests in data wrangling and visualization.

» More about Joe

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

Sachin on Dec. 17, 2019

Nice, clear and simple explanation!! This is first time I have understood this!!

abakala on Nov. 19, 2019

Thanks, it was very helpful!

Chasp on Sept. 11, 2019

Succinct and understandable… good job!

« Browse All Courses