![]() |
No Module found in other directory than source code [SOLVED] - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: No Module found in other directory than source code [SOLVED] (/thread-35505.html) |
No Module found in other directory than source code [SOLVED] - AlphaInc - Nov-10-2021 Hello, I have a question regarding a few python scripts I have. I cloned a few GitHub projects I did like to test on my Debian server. When I execute an example script in the project folder it works but when I move the script to another directory and try to execute it there it says File "/home/pi/example_script.py", line 1, in <module> from x import X ModuleNotFoundError: No module named 'x' Do I have to link the script to the source code / project folder ? If yes, how do I do so? RE: No Module found in other directory than source code [SOLVED] - AlphaInc - Nov-10-2021 (Nov-10-2021, 04:34 PM)AlphaInc Wrote: Hello, Sorry that was a dumb question, I figured it out myself: import sys #Import sys.path.insert(1, '/path/to/source/code') |