ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.askpython.com/python-modules/absolute-vs-relative-importing |
| Last Crawled | 2026-04-12 05:05:29 (22 hours ago) |
| First Indexed | 2021-05-19 17:57:10 (4 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Absolute vs Relative Importing In Python - AskPython |
| Meta Description | Hello fellow learner! Today we are going to learn about the differences between Absolute vs Relative Importing in Python. |
| Meta Canonical | null |
| Boilerpipe Text | Hello fellow learner! Today we are going to learn about the differences between Absolute vs Relative Importing in Python.
Every time you need a direct function to implement anything in our program we can directly import it from the right library! Now let’s learn about Absolute and Relative Importing in Python programming.
What is Absolute Importing?
When we import modules through absolute importing, we need to include the full path of the module after the
import
keyword
.
The complete path includes the main module/library along with the submodules or functions to be used in the program.
Advantages of Absolute Importing
This approach is clear, straightforward and easy to understand
The absolute import commands remain valid even if the current location of the import statement is changed later.
Disadvantages of Absolute Importing
Let us suppose, we have to import a function that is present at a deeper layer in the root module. The absolute import command for such module will look something like this:
from package_1.sub_package_1.sub_package2.sub_package3.module1 import req_function
If the required function is present even deeper in the layers then it’s gonna get really messy and complicated. That’s when the Relative Importing comes to the rescue!
What is Relative Importing?
In relative approach, we can import a function relative to a certain package or sub package’s location which makes it a better way of importing modules and functions.
We have two types of relative importing approaches namely
implicit
and
explicit
approach but the implicit approach doesn’t support with Python3.x versions anymore.
The relative importing approach is illustrated below:
from .sub_package_x.module_5 import req_function
The initial
.
takes into consideration all the previous host modules/libraries and we don’t need to write the whole thing like absolute importing.
Advantages of Relative Importing
The import statements are short and crisp.
Reduces the complexity of the import statement
Disadvantages of Relative Importing
This approach is not very readable and the programmer is unaware of many root modules.
The programmer is unaware of the origin of the function we are importing
Now you know the basic differences between absolute vs relative importing approaches.
I would recommend you to go for absolute approach as a beginner and as you advance your coding experience you can start using relative approach. |
| Markdown | [Skip to content](https://www.askpython.com/python-modules/absolute-vs-relative-importing#main)
- [About AskPython](https://www.askpython.com/about)
- [Blog](https://www.askpython.com/blog)
- [Contact Me](https://www.askpython.com/contact-me)
- [Free Online Developer Tools Hub](https://www.askpython.com/free-online-tools)
- [Home](https://www.askpython.com/)
- [Meet the Team](https://www.askpython.com/team)
- [Privacy Policy](https://www.askpython.com/privacy-policy)
- [Python](https://www.askpython.com/python-programming)
- [Python Course for Beginners Online FREE](https://www.askpython.com/python-course-for-beginners)
- [Python Tutorial – Mega Index](https://www.askpython.com/python-tutorial-index)
- [Terms and Conditions](https://www.askpython.com/terms-and-conditions)
🚀 Supercharge your YouTube channel's growth with AI.
[Try YTGrowAI Free](https://ytgrowai.com/)
Ă—
- [Home](https://www.askpython.com/)
- [Blog](https://www.askpython.com/blog)
- [About AskPython](https://www.askpython.com/about)
- [Python Course](https://www.askpython.com/python-course-for-beginners)
- [Start Here](https://www.askpython.com/python-programming)
Search
Menu
# Absolute vs Relative Importing In Python
- [](https://www.askpython.com/author/isha)[Isha Bansal](https://www.askpython.com/author/isha "Posts by Isha Bansal")
- May 19, 2021
- [Python Modules](https://www.askpython.com/python-modules)

Absolute Vs Relative Importing
Hello fellow learner! Today we are going to learn about the differences between Absolute vs Relative Importing in Python.
Every time you need a direct function to implement anything in our program we can directly import it from the right library! Now let’s learn about Absolute and Relative Importing in Python programming.
## What is Absolute Importing?
When we import modules through absolute importing, we need to include the full path of the module after the [`import` keyword](https://www.askpython.com/python/python-import-statement).
The complete path includes the main module/library along with the submodules or functions to be used in the program.
### Advantages of Absolute Importing
1. This approach is clear, straightforward and easy to understand
2. The absolute import commands remain valid even if the current location of the import statement is changed later.
### Disadvantages of Absolute Importing
Let us suppose, we have to import a function that is present at a deeper layer in the root module. The absolute import command for such module will look something like this:
```
from package_1.sub_package_1.sub_package2.sub_package3.module1 import req_function
```
If the required function is present even deeper in the layers then it’s gonna get really messy and complicated. That’s when the Relative Importing comes to the rescue\!
## What is Relative Importing?
In relative approach, we can import a function relative to a certain package or sub package’s location which makes it a better way of importing modules and functions.
We have two types of relative importing approaches namely `implicit` and `explicit` approach but the implicit approach doesn’t support with Python3.x versions anymore.
The relative importing approach is illustrated below:
```
from .sub_package_x.module_5 import req_function
```
The initial `.` takes into consideration all the previous host modules/libraries and we don’t need to write the whole thing like absolute importing.
### Advantages of Relative Importing
1. The import statements are short and crisp.
2. Reduces the complexity of the import statement
### Disadvantages of Relative Importing
1. This approach is not very readable and the programmer is unaware of many root modules.
2. The programmer is unaware of the origin of the function we are importing
## Conclusion – Absolute vs Relative Importing
Now you know the basic differences between absolute vs relative importing approaches.
I would recommend you to go for absolute approach as a beginner and as you advance your coding experience you can start using relative approach.
[](https://www.askpython.com/author/isha)
##### Isha Bansal
Hey there stranger\!
Do check out my blogs if you are a keen learner\!
Hope you like them\!
[Articles: 187](https://www.askpython.com/author/isha)
[ Previous Post Saving and Loading Models Using TensorFlow 2.0+](https://www.askpython.com/python-modules/saving-loading-models-tensorflow)
[Next Post Tkinter Alarm Clock - A Step-By-Step Guide ](https://www.askpython.com/python-modules/tkinter/tkinter-alarm-clock)
#### Related Posts
[](https://www.askpython.com/python-modules/scipy/scipy-fft)
#### [scipy.fft: Fast Fourier Transform for Signal Analysis](https://www.askpython.com/python-modules/scipy/scipy-fft)
- February 11, 2026
[](https://www.askpython.com/python-modules/python-datetime-module)
#### [Python datetime module guide](https://www.askpython.com/python-modules/python-datetime-module)
- January 25, 2026
[](https://www.askpython.com/python-modules/pandas/pandas-groupby-function)
#### [Pandas groupby: Split, aggregate, and transform data with Python](https://www.askpython.com/python-modules/pandas/pandas-groupby-function)
- January 25, 2026
### Partner Websites
- [GoLangDocs](https://golangdocs.com/)
- [LinuxForDevices](https://www.linuxfordevices.com/)
- [CodeForGeek](https://codeforgeek.com/)
### Popular Categories
- [Python Programming](https://www.askpython.com/python)
- [Python Modules](https://www.askpython.com/python-modules)
- [OOPS in Python](https://www.askpython.com/python/oops)
- [Python Programming Examples](https://www.askpython.com/python/examples)
- [Strings in Python](https://www.askpython.com/python/string)
### Hall of Fame
- [Python Programming](https://www.askpython.com/python-programming)
- [OOPS in Python](https://www.askpython.com/python/oops/object-oriented-programming-python)
- [Creating a Python Module](https://www.askpython.com/python-modules/creating-a-python-module)
- [\*args and \*\*kwargs in Python](https://www.askpython.com/python/args-kwargs-in-python)
- [Python Dictionary (Dict) Tutorial](https://www.askpython.com/python/dictionary/python-dictionary-dict-tutorial)
- [Python List – 15 Things You MUST Know](https://www.askpython.com/python/list/python-list)
- [Python Set – Things You MUST Know](https://www.askpython.com/python/set/python-set)
- [Python String Functions](https://www.askpython.com/python/string/python-string-functions)
### Important Links
- [Home](https://www.askpython.com/)
- [Python Course](https://www.askpython.com/python-course-for-beginners)
- [Start Here](https://www.askpython.com/python-programming)
- [Blog](https://www.askpython.com/blog)
- [About AskPython](https://www.askpython.com/about)
###### Latest posts
- [How Do UI/UX Design Services Validate Product-Market Fit?](https://www.askpython.com/resources/ui-ux-design-services-validate-product-market-fit)
- [Introduction To Cryptocurrency Trading With Python](https://www.askpython.com/resources/introduction-to-cryptocurrency-trading-with-python)
- [Automating Screenshot Generation for Web Applications in Python](https://www.askpython.com/resources/automating-screenshot-generation-for-web-applications-in-python)
- [scipy.fft: Fast Fourier Transform for Signal Analysis](https://www.askpython.com/python-modules/scipy/scipy-fft)
- [Use of Programming in Poker](https://www.askpython.com/resources/use-of-programming-in-poker)
Copyright © 2026 - AskPython. All rights reserved. |
| Readable Markdown | Hello fellow learner! Today we are going to learn about the differences between Absolute vs Relative Importing in Python.
Every time you need a direct function to implement anything in our program we can directly import it from the right library! Now let’s learn about Absolute and Relative Importing in Python programming.
## What is Absolute Importing?
When we import modules through absolute importing, we need to include the full path of the module after the [`import` keyword](https://www.askpython.com/python/python-import-statement).
The complete path includes the main module/library along with the submodules or functions to be used in the program.
### Advantages of Absolute Importing
1. This approach is clear, straightforward and easy to understand
2. The absolute import commands remain valid even if the current location of the import statement is changed later.
### Disadvantages of Absolute Importing
Let us suppose, we have to import a function that is present at a deeper layer in the root module. The absolute import command for such module will look something like this:
```
from package_1.sub_package_1.sub_package2.sub_package3.module1 import req_function
```
If the required function is present even deeper in the layers then it’s gonna get really messy and complicated. That’s when the Relative Importing comes to the rescue\!
## What is Relative Importing?
In relative approach, we can import a function relative to a certain package or sub package’s location which makes it a better way of importing modules and functions.
We have two types of relative importing approaches namely `implicit` and `explicit` approach but the implicit approach doesn’t support with Python3.x versions anymore.
The relative importing approach is illustrated below:
```
from .sub_package_x.module_5 import req_function
```
The initial `.` takes into consideration all the previous host modules/libraries and we don’t need to write the whole thing like absolute importing.
### Advantages of Relative Importing
1. The import statements are short and crisp.
2. Reduces the complexity of the import statement
### Disadvantages of Relative Importing
1. This approach is not very readable and the programmer is unaware of many root modules.
2. The programmer is unaware of the origin of the function we are importing
Now you know the basic differences between absolute vs relative importing approaches.
I would recommend you to go for absolute approach as a beginner and as you advance your coding experience you can start using relative approach. |
| Shard | 106 (laksa) |
| Root Hash | 16638038953198908706 |
| Unparsed URL | com,askpython!www,/python-modules/absolute-vs-relative-importing s443 |