Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it bad practise to not use __init__.py files in a python project? [duplicate]

Tags:

python

I am working on a python project that doesn't have too much cross use of functions in different files. I also don't have cases where a file is needing to use something in a different folder than the one it is in.

Is it bad practise for me not to have any __init__.py files in the project at the moment. I don't fully understand the benefit of adding them in?

like image 408
Daniel Wyatt Avatar asked Sep 02 '25 06:09

Daniel Wyatt


1 Answers

An __init__.py file makes Python treat a folder as a module, so you can import foldername. It is commonly used for large modules.

If you're not doing that, you don't need an __init__.py file.

like image 89
kindall Avatar answered Sep 04 '25 20:09

kindall