-1

I know this question is very common and may be tagged as duplicate, however I have read almost all answers and nothing helps. I am writing this question in desperation. My file structures is the following:

my_project
|--__init__.py
|--some_file.py
|--module1 
  |--a.py 
  |--__init__.py
|--module2
  |--b.py
  |--__init__.py

what I want to do is to import functionality of a.py in b.py I write

from module1 import a

This throws an error "there is no module named module1"
I am working in python3.7.4

Vahagn Tumanyan
  • 500
  • 1
  • 13
  • 29
  • Check [this post](https://stackoverflow.com/questions/13598958/import-modules-from-different-folders) and let me know if it works. – Daniel Ocando Feb 03 '20 at 07:43

1 Answers1

1

What you are doing there is called a relative import, you can read more about them here. try doing the following.

from .module1 import a

A relative import specifies the resource to be imported relative to the current location.

mohsinali
  • 286
  • 1
  • 9