Demystifying Python Modules and Imports: How Imports Really Work in Python

Experience Level: all

Every Python developer has been there - an import that should work doesn’t, and the dreaded “cannot import name” message appears. I’ll try to explain the difference between absolute and relative imports, why do you need init.py files and why abusing sys.path is not a good idea.


  • Timeslot: Sunday, 6th April 2025, 14:00-15:00, Room C
  • Tags: other

There’s a common joke that in Python, there’s a library for everything, you just need to “import stuff” and it works. As long as you import from PyPI, you are mostly safe. But when trying to create your own project structure and the imports start failing, the frustration sets in. Why do some imports fail with a ModuleNotFoundError? Why do circular imports happen? And what exactly is Python doing under the hood?

In this talk, I will break down:

  • How Python finds and loads modules behind the scenes
  • Absolute vs. relative imports - when to use which, and why it matters
  • The real cause of circular imports and how to fix them without hacks
  • What sys.path and __init__.py actually do in project structure

Python makes importing code look easy - until it stops working. This session will give you the knowledge to troubleshoot confusing import errors, organize your projects effectively, and finally understand why Python imports work the way they do.


Kamil Marut

I am a Python software engineer with over 7 years of experience. Currently working as a team lead for Finmatics, an AI-driven accounting company and simultaneously running my own product development consultancy, Majikode, where I design pragmatic and maintainable software. Being exposed to a lot of junior engineers during my day-to-day and, most recently, attending Django Vienna, made me realize that I have a lot of knowledge I would love to share with others.

Privately I love to tinker on my homelab, swim (and recently scuba dive) and do escape rooms!

kamil-marut