How to make PyCharm recognize a package not in PYTHONPATH
<p>I'm using PyCharm to do some maintenance on a Python program that was developed without an IDE. The program imports a package that I'll call zzz. Package zzz is in a directory named zzz, which is in a directory that I'll call xxx. Directory zzz contains an __init__.py file, but no zzz.py file.</p>

<p>Package zzz is not in PYTHONPATH, but the program gains access to it like this:</p>

<pre><code>sys.path.append(&lt;absolute path of directory xxx&gt;)
sys.path.append('zzz/zzz')
import zzz
</code></pre>

<p>After the import I can float the cursor over the name of package zzz and see that its pathname is the absolute pathname of directory zzz.</p>

<p>But PyCharm flags the import statement as an error, presumably because it can't find zzz in the pre-runtime PYTHONPATH.</p>

<p>I tried adding the pathname of zzz to the project's content folders (Files > Settings dialog, Project > Project Structure page). I marked it as a source folder. PyCharm still flags "import zzz" as an error.</p>

<p>This makes it hard to tell when the program contains a real error! The "at least one error found" icon (an exclamation mark in a red circle) appears above the scroll bar, regardless. What can I do to make PyCharm recognize zzz as valid?</p>

<p>I should note that "reorganize the directories" is not a viable solution; nor is "permanently change PYTHONPATH." We have a dozen or so programs that use zzz and load it the same way; I don't have the authority to move it, and the person who has the authority would not be willing to do so. Nor would the programs' users be willing to change their PYTHONPATH to help me make PyCharm happy!</p>