title: How to Import Multiple Python Modules from Other Directories
body: <p>Python newbie here. Any and all help on python structure would be much appreciated! </p>
  
  <p><strong>MAIN QUES: How to Import Multiple Python Modules from Other Directories</strong></p>
  
  <p>I've reassembled the repository for a project so that modules for specific tasks are within individual folders according to type of task instead of just one huge folder. Because my modules were all in one folder, I used to be able to import easily in this fashion:</p>
  
  <pre><code>import sys
  sys.path.insert(0,'/home/myname/folder_name/all_modules')
  </code></pre>
  
  <p>Now, I have four module folders.</p>
  
  <ol>
  <li>aws_boto_modules</li>
  <li>email_modules</li>
  <li>gen_modules</li>
  <li>mongo_modules</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/gfNs7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gfNs7.jpg" alt="Python directory"></a></p>
  
  <p>I want to import two of these modules into <strong>script_to_run.py</strong>.</p>
  
  <p>What I tried that did not work:</p>
  
  <pre><code>import sys
  sys.path.insert(0,'/home/myname/folder_name/email_modules')
  sys.path.insert(0,'/home/myname/folder_name/gen_modules')
  </code></pre>
  
  <ul>
  <li>I tried sys.path.append as well. </li>
  <li>I added to my PYTHONPATH on my local comp (MAC OS) and everything works dandy. However, when I change the PYTHONPATH on my AWS EC2 and attempt to run script_to_run.py, it cannot find email_modules nor gen_modules.</li>
  </ul>
  
  <p>I've read a lot in the last three hours, but am still very confused about how to proceed. Any guidance, including useful links that I may not have encountered already, would be greatly appreciated. Thanks! </p>