Hey guys,
I am in the examples/run.py file and want to import the InputManager class from the input/input_manager.py module. However if I try to run my code I get the following error:
ModuleNotFoundError: No module named ‘input’
How can I achieve my goal?
I will attach a screenshot of my project structure so you can better understand my problem.
Every help is kindly appreciated.
Thanks,
Peter
Hi your import directive at the top is malformed.
The red squiggly means there is a syntax error in your code and the python interpretor cannot compile and run it
try:
from input.input_manager import InputManager
Thank you for your suggestion. I have tried this before but it still doesn’t work. I still get the same error. The reason given for the red suiggly underline according to python is: Attempted relative import beyond top-level package.
I believe the reasen for the import problem is that the input_manager.py file and the run.py file are not in the same package. But there has to be a different way to make my solution work.
Can you put run.py in the root directory (TAYLOR_GREEN_VORTEX_FV_V4) see if it works then.
If you need the file there in that location, maybe you can create it as a function and call it else where in your program
I tried putting the run.py file in the rrot directory but it still doesn’t work. I will just delete the example_case folder and move the two json files and the run.py file into the root directory. While this isn’t the clean solution I wanted it at least works then.
Thank you very much for your help lucidlear. I really appreciate it.