PyCharm is claiming a local import is an unresolved reference, but when I run the script through Run/Debug mode (yes, while the import is still highlighted as red) the script runs fine. I tried restarted PyCharm to see if the error would go away but this hasn't resolved it. I am using the follow PyCharm:
PyCharm 2018.1.4 (Professional Edition)
The structure of my project is like this:
In bar.py, I have "import foo". The current working directory for bar.py is also set to root/scripts1/. However, PyCharm complains that "import foo" is an unresolved reference and underlines the whole thing in red. Nevertheless, I can still execute bar.py with the foo import when using the Run/Debug mode. PyCharm wants me to do "from . import foo" but this actually breaks my script! root/scripts1 is not a Python module/package and does not have an __init__.py (or in the parent dir either).
Why is this happening and how do I fix it?