How to get the name of dir from where a python script is called (not exaclty where it ran)
<p>I have a Python script, named <code>script.py</code>. It's located on <code>~/scripts/script.py</code>.</p>

<p>I have an alias in <code>~/.bash_aliases</code>:</p>

<pre><code>alias script='python ~/scripts/script.py'
</code></pre>

<p>I have some directories in a checked out repository, for example:</p>

<pre><code>~/repository/project_dir/module_name/
</code></pre>

<p>I run on my terminal, inside <code>~/repository/project_dir/module_name/</code>, the <code>script</code> alias I created. This script has a print statement printing the directory from where the <code>script.py</code> was run, but I want it to print from where it was <strong>called</strong>. How do I do it?</p>

<p>(Now, I'm using <code>os.path.abspath(sys.argv[0])</code> and it prints <code>~/scripts/script.py</code> instead of <code>~/repository/project_dir/module_name/</code>)</p>
