why __init__.py must be include in the directory?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

why __init__.py must be include in the directory??

9th Apr 2017, 8:44 AM
Thanda Oo
Thanda Oo - avatar
1 Answer
+ 4
This file is not needed in all Python programs. But it has to be included in Python Packages to mark directories on disk as a Python package directories. Plus it is the first file to be loaded in a module, so you can use it to execute code that you want to run each time a module is loaded.
9th Apr 2017, 9:36 AM
Suhaib Khan
Suhaib Khan - avatar