title: Creating a function to load data into a list? Passing filename to import through function
body: <p>I am new to writing functions and modules, and I need some help creating a function within my new module that will make my currently repetitive process of loading data much more efficient.</p>
  
  <p>I would like this function to reside in a larger overall module with other function that I can keep stored on my home directory and not have to copy into my working directory every time I want to call one of my function.  </p>
  
  <p>The data that I have is just some JSON Twitter data from the streaming API, and <strong>I would like to use a function to load the data (list of dicts) into a list that I can access after the function runs</strong> by using something like <code>data = my_module.my_function('file.json')</code>. </p>
  
  <p>I've created a folder in my home directory for my python modules and I have two files in that directory: <code>__init__.py</code> and <code>my_module.py</code>.</p>
  
  <p>I've also went ahead and added the python module folder to <code>sys.path</code> by using <code>sys.path.append('C:\python')</code></p>
  
  <p>Within python module folder, the file <code>__init__.py</code> has nothing in it, it's just an empty file.  </p>
  
  <p><strong>Do I need to put anything in the</strong> <code>__init__.py</code> <strong>file?</strong></p>
  
  <p><code>my_module.py</code> <strong>has the following code:</strong></p>
  
  <pre><code>import json
  
  def my_function(parameter1):
      tweets = []
      for line in open(parameter1):
          try: 
              tweets.append(json.loads(line))
          except:
              pass
  </code></pre>
  
  <p><strong>I would like to cal the function as such:</strong>
      import my_module
      data = my_module.my_function('tweets.json')</p>
  
  <p>What else do I need to do to create this function to make loading my data more efficient?</p>