0

when i was coding i used multiple python files that contains inherited classes, then when i wanted to import them to the main python file where we found the mother class it rises an Error:

lets say this is the architecture:

.../myProject/main.py > The main python file "contains the parent Class "

.../myProject/child/... > Where we found the other python files that contains inherited classes

when i tried to import files from .../myProject/child/... to main.py it raises an Error: ImportError: No module named [Parent class]

after some researches i found a method that solves the problem which is: importing the Parent class's file to the child file but the problem here is that the child file is not in the same path. is there any solutions to that.... or maybe Another Method please and thank you

Community
  • 1
  • 1
  • Does this answer your question? [How to import other Python files?](https://stackoverflow.com/questions/2349991/how-to-import-other-python-files) – Onilol Feb 21 '20 at 15:52
  • If you setup a regular import package for your project files, with `__init__.py` files in folders, you will be able to import from wherever you want inside your package. – progmatico Feb 21 '20 at 20:02

0 Answers0