ℹ️ 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.2 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/what-does-dot-mean-in-python-import |
| Last Crawled | 2026-04-12 07:15:23 (4 days ago) |
| First Indexed | 2023-05-31 05:25:11 (2 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Understanding Python Import Statements: What does a '.' Mean? - AskPython |
| Meta Description | The import statement in Python allows us to access in built functions present in other files. Instead of writing one program over and over again for using it |
| Meta Canonical | null |
| Boilerpipe Text | The
import
statement in Python allows us to access in built functions present in other files. Instead of writing one program over and over again for using it in various different functions, Python’s flexibility achieve this feat with just one statement.
There are two major types of imports in Python:
absolute imports
and
relative imports
. Most of the time we use absolute imports but sometimes it is effective to use relative imports.
A dot or a period (.) in an import statement is the directory of a module for relative imports in Python. It is how relative imports are done in Python. Import statements can be used to use all the functions inside a particular module or libraries only with one line. When performing relative imports we are going to use the “dot” in the import statement.
What are Python Import Statements? An Explanation
Importing in Python brings in existing code from other files, eliminating the need for repetitive coding. In programming, especially in Python, imports allow us to use existing code from other files into our own code without having to write them all over again.
Import statements can be used to use all the functions inside a particular module or libraries only with one line.
The Benefits of Using Import Statements in Python
There are many advantages of using import statements in your code. Such as:
It makes your code more effective.
It makes your code look nice and clean
You avoid writing extra lines of code over and over again.
You can use variables from various other modules into your code and not have to worry about assigning variables that you might need at runtime.
You can import data files as well into your program.
Best Practices and Rules for Importing in Python
There are some rules to importing modules and files in Python. They are:
One should always write all of the import statements at the very top of the code block. All of the required modules or libraries should be imported at the very beginning.
There is a hierarchy that one should follow when importing various files. All of the required in built modules should be imported at the very beginning. Modules that have been installed along with the python installation comes under this type.
This is followed by imports of all of the third-party packages that weren’t installed via the official installer.
The files on your local machine that you might need in your current code is imported as the final successor of the above two statements.
Import statements are very easy to use. You just need to use the import statement before a module’s or a package’s name to import it. For example,
import math
If you want to assign the package’s content into a variable you can use the “as” keyword followed by the variable name as well.
import math as var_name
To know more about how to import files in your Python program,
click here
!
Absolute vs Relative Imports: A Deeper Dive
Absolute imports provide the full path of a module, while relative imports only indicate the directory relative to the current file.
There used to be two kinds of relative imports in the previous versions of Python that is before Python3. Those were implicit relative imports and explicit relative imports.
Implicit relative imports are were in general very messy, hence they were not supported anymore in Python 3. This is why only explicit relative imports exist nowadays because they are easy to use and clean.
Let’s consider a directory containing a Python modules which further contains sub modules or programs in them as follows:
Module Paths And Hierarchies
Using Absolute Imports
First Scenario:
Suppose we have a Python module, let’s call it “
third_module
“, inside a directory or library named “
second_library
“.
Absolute Import:
To import a function, say “
function1
“, from this “
third_module
” using an absolute import, our statement would look like this:
from second_library.third_module import function1
. This provides the full path of the function within the module hierarchy.
#using absolute import method to import function1 from the third_module
from second_library.third_module import function1
There are some disadvantages to using absolute imports. When the paths are long and there are numerous sub packages in a single directory when importing multiple functions, this method becomes very wordy and inaccurate.
Using Relative Imports
Second Scenario:
Now, let’s consider we are inside the same “second_library” and want to import “function2” from the “third_module”.
Relative Import:
We can use a single dot (.) representing the current directory in our import statement, like this:
from .third_module import function2
. This way, we only specify the location of “third_module” relative to the current file.
Third Scenario:
Suppose we have another library named “first_library” at the same level as “second_library”, and we want to import “module1” from “first_library”.
Relative Import:
We can use two dots (..) representing the directory above the current directory in our import statement, like this:
from ..first_library import module1
.
Fourth Scenario:
For importing “second_library” from a grandparent directory named “Our_Directory”, we can use three dots (…) in our import statement.
Relative Import:
Our import statement would look like this:
from ...Our_Directory import second_library
#examples of relative imports
from .third_module import function2
from .. first_library import module1
from ... our_directory import second_library
There are disadvantages to using relative imports as well. When directory structures change from one system to another, it becomes difficult to keep track of them. The locations become difficult to pinpoint.
To know more in depth about absolute and relative imports, check out this
article
!
Python Import Statements: Final Thoughts and Considerations
It is very important to know how to use import statements in Python. They are efficient and make your code look clean and nice and legible. There are two ways of using imports, they are the absolute import statements and the relative import statements. Both have their pros and cons.
Do you think relative imports are easier than absolute imports or the opposite? |
| Markdown | [Skip to content](https://www.askpython.com/python-modules/what-does-dot-mean-in-python-import#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
# Understanding Python Import Statements: What does a ‘.’ Mean?
- [](https://www.askpython.com/author/shreya)[Shreya Bose](https://www.askpython.com/author/shreya "Posts by Shreya Bose")
- May 31, 2023
- [Python Modules](https://www.askpython.com/python-modules)

What Does A DOT( ) In An Import Statement In Python Mean
The [import](https://docs.python.org/3/reference/import.html) statement in Python allows us to access in built functions present in other files. Instead of writing one program over and over again for using it in various different functions, Python’s flexibility achieve this feat with just one statement.
There are two major types of imports in Python: **absolute imports** and **relative imports**. Most of the time we use absolute imports but sometimes it is effective to use relative imports.
> A dot or a period (.) in an import statement is the directory of a module for relative imports in Python. It is how relative imports are done in Python. Import statements can be used to use all the functions inside a particular module or libraries only with one line. When performing relative imports we are going to use the “dot” in the import statement.
## What are Python Import Statements? An Explanation
Importing in Python brings in existing code from other files, eliminating the need for repetitive coding. In programming, especially in Python, imports allow us to use existing code from other files into our own code without having to write them all over again.
Import statements can be used to use all the functions inside a particular module or libraries only with one line.
### The Benefits of Using Import Statements in Python
There are many advantages of using import statements in your code. Such as:
- It makes your code more effective.
- It makes your code look nice and clean
- You avoid writing extra lines of code over and over again.
- You can use variables from various other modules into your code and not have to worry about assigning variables that you might need at runtime.
- You can import data files as well into your program.
### Best Practices and Rules for Importing in Python
There are some rules to importing modules and files in Python. They are:
- One should always write all of the import statements at the very top of the code block. All of the required modules or libraries should be imported at the very beginning.
- There is a hierarchy that one should follow when importing various files. All of the required in built modules should be imported at the very beginning. Modules that have been installed along with the python installation comes under this type.
- This is followed by imports of all of the third-party packages that weren’t installed via the official installer.
- The files on your local machine that you might need in your current code is imported as the final successor of the above two statements.
Import statements are very easy to use. You just need to use the import statement before a module’s or a package’s name to import it. For example,
```
import math
```
If you want to assign the package’s content into a variable you can use the “as” keyword followed by the variable name as well.
```
import math as var_name
```
To know more about how to import files in your Python program, [click here](https://www.askpython.com/python/built-in-methods/import-other-python-files)\!
## Absolute vs Relative Imports: A Deeper Dive
Absolute imports provide the full path of a module, while relative imports only indicate the directory relative to the current file.
There used to be two kinds of relative imports in the previous versions of Python that is before Python3. Those were implicit relative imports and explicit relative imports.
Implicit relative imports are were in general very messy, hence they were not supported anymore in Python 3. This is why only explicit relative imports exist nowadays because they are easy to use and clean.
Let’s consider a directory containing a Python modules which further contains sub modules or programs in them as follows:

Module Paths And Hierarchies
### Using Absolute Imports
- **First Scenario:** Suppose we have a Python module, let’s call it “**third\_module**“, inside a directory or library named “**second\_library**“.
- **Absolute Import:** To import a function, say “**function1**“, from this “**third\_module**” using an absolute import, our statement would look like this: `from second_library.third_module import function1`. This provides the full path of the function within the module hierarchy.
```
#using absolute import method to import function1 from the third_module
from second_library.third_module import function1
```
There are some disadvantages to using absolute imports. When the paths are long and there are numerous sub packages in a single directory when importing multiple functions, this method becomes very wordy and inaccurate.
### Using Relative Imports
- **Second Scenario:** Now, let’s consider we are inside the same “second\_library” and want to import “function2” from the “third\_module”.
- **Relative Import:** We can use a single dot (.) representing the current directory in our import statement, like this: `from .third_module import function2`. This way, we only specify the location of “third\_module” relative to the current file.
- **Third Scenario:** Suppose we have another library named “first\_library” at the same level as “second\_library”, and we want to import “module1” from “first\_library”.
- **Relative Import:** We can use two dots (..) representing the directory above the current directory in our import statement, like this: `from ..first_library import module1`.
- **Fourth Scenario:** For importing “second\_library” from a grandparent directory named “Our\_Directory”, we can use three dots (…) in our import statement.
- **Relative Import:** Our import statement would look like this: `from ...Our_Directory import second_library`
```
#examples of relative imports
from .third_module import function2
from .. first_library import module1
from ... our_directory import second_library
```
There are disadvantages to using relative imports as well. When directory structures change from one system to another, it becomes difficult to keep track of them. The locations become difficult to pinpoint.
To know more in depth about absolute and relative imports, check out this [article](https://www.askpython.com/python-modules/absolute-vs-relative-importing)\!
## Python Import Statements: Final Thoughts and Considerations
It is very important to know how to use import statements in Python. They are efficient and make your code look clean and nice and legible. There are two ways of using imports, they are the absolute import statements and the relative import statements. Both have their pros and cons. *Do you think relative imports are easier than absolute imports or the opposite?*
[](https://www.askpython.com/author/shreya)
##### Shreya Bose
[Articles: 106](https://www.askpython.com/author/shreya)
[ Previous Post How Struct.pack() Is Used to Create Packets?](https://www.askpython.com/python/built-in-methods/struct-pack-create-packets)
[Next Post How to Extract Text Before a Colon (:) Using Regex in Python? ](https://www.askpython.com/python/examples/extracting-text-before-colon-python-regex)
#### 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 | The [import](https://docs.python.org/3/reference/import.html) statement in Python allows us to access in built functions present in other files. Instead of writing one program over and over again for using it in various different functions, Python’s flexibility achieve this feat with just one statement.
There are two major types of imports in Python: **absolute imports** and **relative imports**. Most of the time we use absolute imports but sometimes it is effective to use relative imports.
> A dot or a period (.) in an import statement is the directory of a module for relative imports in Python. It is how relative imports are done in Python. Import statements can be used to use all the functions inside a particular module or libraries only with one line. When performing relative imports we are going to use the “dot” in the import statement.
## What are Python Import Statements? An Explanation
Importing in Python brings in existing code from other files, eliminating the need for repetitive coding. In programming, especially in Python, imports allow us to use existing code from other files into our own code without having to write them all over again.
Import statements can be used to use all the functions inside a particular module or libraries only with one line.
### The Benefits of Using Import Statements in Python
There are many advantages of using import statements in your code. Such as:
- It makes your code more effective.
- It makes your code look nice and clean
- You avoid writing extra lines of code over and over again.
- You can use variables from various other modules into your code and not have to worry about assigning variables that you might need at runtime.
- You can import data files as well into your program.
### Best Practices and Rules for Importing in Python
There are some rules to importing modules and files in Python. They are:
- One should always write all of the import statements at the very top of the code block. All of the required modules or libraries should be imported at the very beginning.
- There is a hierarchy that one should follow when importing various files. All of the required in built modules should be imported at the very beginning. Modules that have been installed along with the python installation comes under this type.
- This is followed by imports of all of the third-party packages that weren’t installed via the official installer.
- The files on your local machine that you might need in your current code is imported as the final successor of the above two statements.
Import statements are very easy to use. You just need to use the import statement before a module’s or a package’s name to import it. For example,
```
import math
```
If you want to assign the package’s content into a variable you can use the “as” keyword followed by the variable name as well.
```
import math as var_name
```
To know more about how to import files in your Python program, [click here](https://www.askpython.com/python/built-in-methods/import-other-python-files)\!
## Absolute vs Relative Imports: A Deeper Dive
Absolute imports provide the full path of a module, while relative imports only indicate the directory relative to the current file.
There used to be two kinds of relative imports in the previous versions of Python that is before Python3. Those were implicit relative imports and explicit relative imports.
Implicit relative imports are were in general very messy, hence they were not supported anymore in Python 3. This is why only explicit relative imports exist nowadays because they are easy to use and clean.
Let’s consider a directory containing a Python modules which further contains sub modules or programs in them as follows:

Module Paths And Hierarchies
### Using Absolute Imports
- **First Scenario:** Suppose we have a Python module, let’s call it “**third\_module**“, inside a directory or library named “**second\_library**“.
- **Absolute Import:** To import a function, say “**function1**“, from this “**third\_module**” using an absolute import, our statement would look like this: `from second_library.third_module import function1`. This provides the full path of the function within the module hierarchy.
```
#using absolute import method to import function1 from the third_module
from second_library.third_module import function1
```
There are some disadvantages to using absolute imports. When the paths are long and there are numerous sub packages in a single directory when importing multiple functions, this method becomes very wordy and inaccurate.
### Using Relative Imports
- **Second Scenario:** Now, let’s consider we are inside the same “second\_library” and want to import “function2” from the “third\_module”.
- **Relative Import:** We can use a single dot (.) representing the current directory in our import statement, like this: `from .third_module import function2`. This way, we only specify the location of “third\_module” relative to the current file.
- **Third Scenario:** Suppose we have another library named “first\_library” at the same level as “second\_library”, and we want to import “module1” from “first\_library”.
- **Relative Import:** We can use two dots (..) representing the directory above the current directory in our import statement, like this: `from ..first_library import module1`.
- **Fourth Scenario:** For importing “second\_library” from a grandparent directory named “Our\_Directory”, we can use three dots (…) in our import statement.
- **Relative Import:** Our import statement would look like this: `from ...Our_Directory import second_library`
```
#examples of relative imports
from .third_module import function2
from .. first_library import module1
from ... our_directory import second_library
```
There are disadvantages to using relative imports as well. When directory structures change from one system to another, it becomes difficult to keep track of them. The locations become difficult to pinpoint.
To know more in depth about absolute and relative imports, check out this [article](https://www.askpython.com/python-modules/absolute-vs-relative-importing)\!
## Python Import Statements: Final Thoughts and Considerations
It is very important to know how to use import statements in Python. They are efficient and make your code look clean and nice and legible. There are two ways of using imports, they are the absolute import statements and the relative import statements. Both have their pros and cons. *Do you think relative imports are easier than absolute imports or the opposite?* |
| Shard | 106 (laksa) |
| Root Hash | 16638038953198908706 |
| Unparsed URL | com,askpython!www,/python-modules/what-does-dot-mean-in-python-import s443 |