↑ ↓ Navigate ↡ Select ESC Close

What does '__init__.py' do in Python?

2025-02-02 Education
272.9k
8.1k
110
Tech With Tim
Tech With Tim
2.0m subscribers

Unlock all features

FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.

Description

πŸ“¬ Join my Free Newsletter: https://techwithtim.net/newsletter πŸŽ“ Get private mentorship from me: https://training.techwithtim.net If you've read a fair amount of Python code, then you've probably seen this "__init__.py" file pop up quite a few times. It's especially common in larger Python projects. I'm going to breakdown exactly what this file is, when you should use it, and exactly how it works. πŸš€ My Software Development Program: https://coursecareers.com/a/techwithtim?course=software-dev-fundamentals&campaign=youtubedescription 🎞 Video Resources 🎞 Newsletter: https://www.techwithtim.net/newsletter DevLaunch: https://training.techwithtim.net/ ⏳ Timestamps ⏳ 00:00 | Understanding Modules & Packages 03:21 | Free Newsletter 04:12 | __init__ Usage 06:40 | Relative Imports & Import Errors 10:06 | Multiple Packages Hashtags #Python #PythonFunctions #SoftwareDevelopment

Top Comments (10)

@TechWithTim 2025-02-02

Get free coding challenges and a guide on 14 unique ways to make money from coding by signing up for my newsletter: https://techwithtim.net/newsletter

17 1 replies
@bjared 2025-12-16

Finally someone who explains __init__.py in a clear and comprehensive manner. Thank you!

16
@mallikarjunkonemane6908 2025-02-02

Post more like this for beginners

106
@cusematt23 2025-02-05

AI tools will create millions of beginner and intermediate coders that can get by. But listening to guys like Tim will actually make you competent at a deeper level that understands the whys the what’s. Which will speed up your progress exponentially.

72 3 replies
@mrfounderr 2025-02-04

I'm learning Fast Api and I kept using these __init__.py but I never knew why they were used. Thanks Tim. It was such a great tutorial.

47
@wellz2000 2025-02-02

The internet gives me access to so much information, it's like having a genius classmate whose brain I can pick for free. Thanks, Tim, you're a lifesaver!

19
@patrickmateus-iq8bi 2025-02-03

I was still using the init file this whole time.πŸ˜‚.... I learned something today. Thank you Tim

5
@dorianlopez7176 2025-02-07

I’m excited to see more beginner friendly videos like these for fast api, Django, etc. Great content, Tim!

8
@alexandrekononov9384 2025-02-02

Thank you, great video. Working with packages is such an important and yet slightly overlooked topic!

7
@ScottyMcCraigles 2025-02-02

Videos like this are super handy. Can you make a video series on topics like this, please!?

8

Unlock the Data Inside
Turn Videos into Knowledge

  • Get FREE 10/day: transcripts, summaries, chats
  • Chat with videos, export text & PDF
  • $1 free API credit for RAG, chatbots & research

Free forever plan β€’ All features unlocked

App screenshot