What Happens When you Import a Python Module?

Deep dive into the import system

Xiaoxu Gao
Towards Data Science
7 min readAug 30, 2022

--

Photo by Mike van den Bos from Unsplash

Reusability is one of the key metrics to measure the quality of the code. It is the extent to which code can be used in different programs with minimal change. In Python, we use import to import code from a module. But have you ever been curious about how import is implemented behind the scenes? In this article, we will deep dive…

--

--

I’m a Developer with a focus on Python and Data Engineering. I write stuff to talk to myself and the world. You can find me on linkedin.com/in/xiaoxugao/.