title: Access data in package subdirectory
body: <p>I am writing a python package with modules that need to open data files in a <code>./data/</code> subdirectory. Right now I have the paths to the files hardcoded into my classes and functions. I would like to write more robust code that can access the subdirectory regardless of where it is installed on the user's system. </p>
  
  <p>I've tried a variety of methods, but so far I have had no luck. It seems that most of the "current directory" commands return the directory of the system's python interpreter, and not the directory of the module. </p>
  
  <p>This seems like it ought to be a trivial, common problem. Yet I can't seem to figure it out. Part of the problem is that my data files are not <code>.py</code> files, so I can't use import functions and the like. </p>
  
  <p>Any suggestions? </p>
  
  <p>Right now my package directory looks like:</p>
  
  <pre><code>/
  __init__.py
  module1.py
  module2.py
  data/   
     data.txt
  </code></pre>
  
  <p>I am trying to access <code>data.txt</code> from <code>module*.py</code>!</p>