1

When running a program of mine in PyCharm, it gives a ModuleNotFoundError. However, when running the exact same program outside of PyCharm using Python shell, it works perfectly fine. The module is a local module that's inside a folder inside the same directory as the program, and has an init.py file. Is there anything else that needs to be done in order to get it to work? I'm somewhat new to PyCharm, and I'm not sure why this isn't working considering it works perfectly fine outside of PyCharm.

fAXvw5Le
  • 11
  • 2
  • similar to [question](https://stackoverflow.com/questions/54955891/how-pycharm-imports-differently-than-system-command-prompt-windows/55083046#55083046) – Udesh Apr 30 '22 at 11:08
  • 1
    It's likely because of the current working directory of where you're executing the module, the directory from where you're executing gets added to your [PYTHONPATH](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH) - there is more than one rule to this. If you are [using a venv](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments) you need to activate it after creation or properly configure it in the IDE. – bad_coder Apr 30 '22 at 16:26

0 Answers0