title: Simplest way to Import a shared python script relative to the current script
body: <p>I am trying to import one python script from another.  I have a few common functions defined in one script and then lots of other scripts that want to import those functions.  No classes, just functions.</p>
  
  <p>The importing script needs to import from a relative path e.g.  <code>../../SharedScripts/python/common.py</code></p>
  
  <p>I then a have a few functions <code>def f1(...)</code> defined which I will call.</p>
  
  <p>I found the imp module which seemed to be the right thing to use but I was unable to figure out the exact syntax that would work for my example.</p>
  
  <p>Can someone suggest the correct code to use or the simplest approach if imp is not the right module?</p>
  
  <p><strong>SOLUTION</strong> from the answers below I was able to get this working...</p>
  
  <pre><code>projectKey = 'THOR'
  
  # load the shared script relative to this script
  sys.path.append(os.path.dirname(__file__) + '/../../SharedScripts/python')
  import jira
  
  jira.CheckJiraCommitMessage(sys.argv[1], sys.argv[2], projectKey)
  </code></pre>
  
  <p>Where I had an empty <code>__init__.py</code> and a <code>jira.py</code> in the <code>SharedScripts/python</code> directory with plain function definitions.</p>