title: Importing from module with the same name as executable file in Python
body: <p>I have an executable file, named, for example, <code>resource.py</code>. It is disposed in the folder named <code>resource</code>. Renaming file or folder is objectionable - it is old product and users accustomed to use such naming. At old version it was under another project, so imports to it sound like <code>import main_product.resource.&lt;..&gt;</code>.</p>
  
  <p>Now I need to use imports like <code>import resource.&lt;..&gt;</code> and <code>__import__('resource.&lt;..&gt;', ...)</code>. Then I try it, I get an expected error, because Python try to import from the file <code>resource.py</code> first.</p>
  
  <p>Suggestion solutions:</p>
  
  <ol>
  <li>remove path of current folder from <code>sys.path</code>:
  
  <ul>
  <li>we need an ugly chunk of code at the begin of the file;</li>
  <li>no relative imports will be available in this folder;</li>
  </ul></li>
  <li>put folder path at the end <code>sys.path</code> list:
  
  <ul>
  <li>bigger chunk of ugly code at the begin of the file;</li>
  <li>i am not sure that this feature will always work perfect.</li>
  </ul></li>
  </ol>
  
  <p>Have any usable idea about this?</p>
  
  <p>P.S. Python v2.6, FreeBSD 7.3</p>