---
# System prepended metadata

title: Import Tricks in Python.
tags: [Python]

---

# Import Tricks in Python.

- View the official [PEP 328](https://www.python.org/dev/peps/pep-0328/#guido-s-decision) to know about `absolute import` and `relative import`.
- Or check this medium blog: [Python 的 Import 陷阱](https://medium.com/pyladies-taiwan/python-%E7%9A%84-import-%E9%99%B7%E9%98%B1-3538e74f57e3#10ac)
- p.s. I think just do what the official blog do. It's simpler! 

Or put it a simple way.
---
We should stop using the `relative import` and start to use the `absolute import`.

Example
---
Stop using this:
```
from module import function
```

Use this:
```
from .module import function
```


###### tags: `Python`
