🔥 BLACK FRIDAY SALE1 course ₹199·any 3 courses ₹399 for 3 months·ALL courses + 1 mock interview ₹599 for 6 monthsClaim offer →

Python · Modules, Packaging and Dependencies · Intermediate · 28 min read

Python Modules, Packages and Imports: How Import Really Works and How to Structure Projects

Understand modules, packages and the import system in depth. See how Python finds and caches modules, how absolute and relative imports work, what __init__.py does, how to avoid circular imports, how to lay out a project with src layout, and how to run code as a module.

Python Modules, Packages and Imports: How Import Really Works and How to Structure Projects: lesson illustration

A first look

  • Intermediate level · 28 min read
  • 6 interview questions with model answers
  • Modules, Packaging and Dependencies · Python Mastery

You will learn to

  • Modules, packages and namespace packages
  • What happens when you write import x: finder, loader, sys.modules
  • Absolute versus relative imports, init.py, all
  • …and 3 more topics inside
Create an account to start

Create a free account to see what this lesson covers

  • Every free lesson in every section, in full
  • Track your progress and pick up where you left off
  • Free practice questions and an incident simulation
  • Takes under a minute: name, email and a password

No card needed. Full access to Python is a paid upgrade you can choose later.