Skip to main content
added 86 characters in body
Source Link
PythonUser
  • 796
  • 6
  • 16
There is problem with import of module from parent directory as __main__ lies in child folder
if you do the folder structure like below your same code for import will work

+----test
     +---test_models.py
     +---__init__.py
     +---address_book
         +---__init__.py
         +---models.py

or you can add your project path to PYTHONPATH variable and your same code will work

There is problem with import of module from parent directory as __main__ lies in child folder
if you do the folder structure like below your same code for import will work

+----test
     +---test_models.py
     +---__init__.py
     +---address_book
         +---__init__.py
         +---models.py
There is problem with import of module from parent directory as __main__ lies in child folder
if you do the folder structure like below your same code for import will work

+----test
     +---test_models.py
     +---__init__.py
     +---address_book
         +---__init__.py
         +---models.py

or you can add your project path to PYTHONPATH variable and your same code will work

Source Link
PythonUser
  • 796
  • 6
  • 16

There is problem with import of module from parent directory as __main__ lies in child folder
if you do the folder structure like below your same code for import will work

+----test
     +---test_models.py
     +---__init__.py
     +---address_book
         +---__init__.py
         +---models.py