I am copying analysis files to my local PyCharm to reproduce parts of it. I have a scsim.py file which runs without errors. But when I call it from another .py file as from scsim import scsim
, it says No module named 'scsim'. Do I have to do something else to make the scsim.py file to work as a module?
Asked
Active
Viewed 29 times
0

Yulia Kentieva
- 641
- 4
- 13
-
2I think you need to create an empty `__init__.py` file inside that `scsim` folder. – Minh-Long Luu Oct 28 '22 at 15:06
-
use `print(os.getcwd())` to know which folder you are running from and is used by `../../code/` as a starting directory, it's probably not what you think – Ahmed AEK Oct 28 '22 at 15:07
-
also having both the folder and the file with the same name can confuse the interpreter when both folders are on your path ... this is wrong. – Ahmed AEK Oct 28 '22 at 15:11
-
@Minh-LongLuu an empty __init__.py file inside scsim folder did not help. – Yulia Kentieva Oct 28 '22 at 18:26
-
@AhmedAEK I used print(os.getcwd()) and I am in the right folder. Renaming the directory also did not help – Yulia Kentieva Oct 28 '22 at 18:28