title: Open file inside class
body: <p>I have a noob question.
  I need to do the class, which in init opening file and other function just appending to this opened file text. How I can do this?
  Need to do something like this, but this is not working, so help.</p>
  
  <p>file1.py</p>
  
  <pre><code>from logsystem import LogginSystem as logsys
  
  file_location='/tmp/test'
  file = logsys(file_location)
  file.write('some message')
  </code></pre>
  
  <p>file2.py</p>
  
  <pre><code>class LogginSystem(object):
  
      def __init__(self, file_location):
          self.log_file = open(file_location, 'a+')
  
      def write(self, message):
          self.log_file.write(message)
  </code></pre>
  
  <p>Thanks</p>