pythonmodular-design

Unable to call local directory call in python


I have created base folder as test_proj then inside test_proj new test folder created with class file hello1.py with method log. Then from test_proj am trying to call this log method but unable to do so.. facing error as ModuleNotFoundError. Screen shot is provided. Any help is highly appreciated.

enter image description here


Solution

  • Add an empty __init__.py file in the test folder.

    The init.py files are required to make Python treat directories containing the file as packages. This prevents directories with a common name, such as string, unintentionally hiding valid modules that occur later on the module search path. In the simplest case, init.py can just be an empty file, but it can also execute initialization code for the package or set the all variable, described later.