title: How can I import my own modules on webserver?
body: <p>I am developing a website and want to put some files on the server. The problem is that I can only import python modules ( e.g. "import os"), but somewhy, can not import my own modules:</p>
  
  <p>test1.py:</p>
  
  <pre><code>import test2
  </code></pre>
  
  <p>test2.py:</p>
  
  <pre><code>print ("Content-type:text/html\n\n")
  print ("&lt;html&gt;")
  print ("&lt;head&gt;")
  print ("&lt;title&gt;Error&lt;/title&gt;")
  print ("&lt;/head&gt;")
  print ("&lt;body&gt;")
  print (" hello world 2")
  print ("&lt;/body&gt;")
  print ("&lt;/html&gt;")
  </code></pre>
  
  <p>If I click www.mywebsite.com/test2.py, then I recieve "hello world" on the screen.
  However, if I click www.mywebsite.com/test1.py, I get "500 internal server error." I found out that it is some problem with not being able to import my modules.</p>
  
  <p>p.s. since I am on a shared server, I can not changes sys path etc....</p>
  
  <p>Here is a trace I got in errors.log:</p>
  
  <pre><code>[Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] mod_python (pid=17816, interpreter='delekulator.co.il', phase='PythonHandler', handler='mod_python.cgihandler'): Application error
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] ServerName: 'delekulator.co.il'
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] DocumentRoot: '/var/www/vhosts/mywebsite.com/httpdocs'
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] URI: '/test1.py'
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] Location: None
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] Directory: '/var/www/vhosts/mywebsite.com/httpdocs/'
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] Filename: '/var/www/vhosts/mywebsite.com/httpdocs/test1.py'
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] PathInfo: ''
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] Traceback (most recent call last):
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249]   File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n    default=default_handler, arg=req, silent=hlist.silent)
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249]   File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target\n    result = _execute_target(config, req, object, arg)
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249]   File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target\n    result = object(arg)
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249]   File "/usr/lib/python2.6/dist-packages/mod_python/cgihandler.py", line 96, in handler\n    imp.load_module(module_name, fd, path, desc)
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249]   File "/var/www/vhosts/mywebsite.com/httpdocs/test1.py", line 1, in &lt;module&gt;\n    import test2
  [Thu Jun 11 00:18:09 2015] [error] [client 85.65.174.249] ImportError: No module named test2
  </code></pre>
  
  <p><strong>In the last line, you can see that the server writes "ImportError: No module named test2"</strong></p>
  
  <p>How can I fix it?</p>