I have a project structure that follows:
myproject/
├── __init__.py
├── module1/
│ ├── __init__.py
│ ├── module_a.py
├── module2/
│ ├── __init__.py
│ ├── module_b.py
I want to access a method in module_b.py from module_a.py, how would I go about doing so?
I have tried from ..module2 import module_b, but that has only given me:
ImportError: attempted relative import with no known parent package
Any help is appreciated, thank you !
submitted by /u/Choice_Stop8579
[link] [comments]
r/learnpython I have a project structure that follows: myproject/ ├── __init__.py ├── module1/ │ ├── __init__.py │ ├── module_a.py ├── module2/ │ ├── __init__.py │ ├── module_b.py I want to access a method in module_b.py from module_a.py, how would I go about doing so? I have tried from ..module2 import module_b, but that has only given me: ImportError: attempted relative import with no known parent package Any help is appreciated, thank you ! submitted by /u/Choice_Stop8579 [link] [comments]
I have a project structure that follows:
myproject/
├── __init__.py
├── module1/
│ ├── __init__.py
│ ├── module_a.py
├── module2/
│ ├── __init__.py
│ ├── module_b.py
I want to access a method in module_b.py from module_a.py, how would I go about doing so?
I have tried from ..module2 import module_b, but that has only given me:
ImportError: attempted relative import with no known parent package
Any help is appreciated, thank you !
submitted by /u/Choice_Stop8579
[link] [comments]