Importing user defined modules in python from a directory
<p>I'm trying to import a module I wrote in python that just prints out a list containing numbers. The issue I'm having is that I want to be able to import it from a separate directory but the answers I have read so far don't seem to be working for my situation.</p>

<p>For example, given I want to import printnumbers.py from a directory in my documents folder I am supposed to implement the following:</p>

<pre><code>    import sys
    sys.path.append('/home/jake/Documents')
    import printnumbers.py
</code></pre>

<p>This snipit of code results in a "Import error" telling me that the specified module does not exist. I'm not exactly sure where to proceed from here, I have checked multiple times to make sure it's the right spelling for the path as well as for the module name. I'm still trying to understand exactly what appending to the "sys.path" does. From what I understand it's telling the program to search for modules in that directory?</p>

<p>Thanks for anyone who answers my rather novice question. I'm just looking for a better understanding of it that the python documentation isn't providing for my frame of mind.</p>