PyCharm import settings

Let's say there is the following project structure:

script_1 and script_2's contents:

PyCharm underlines the import in script_2.py as incorrect. However, this is the only way Python interpreter will accept. If I use `from target.script_1 import now_ts` PyCharm will accept the solution but when executing `python script_2.py` the interpreter will return a ModuleNotFound error. Why does PyCharm requires me to write code incorrectly?

0
1 comment

Hi, try marking "target" directory as "source root" in project structure settings: https://www.jetbrains.com/help/pycharm/project-structure-dialog.html#2f736

0

Please sign in to leave a comment.