title: Variable scope outside of classes
body: <p>My text editor of choice is extensible through python plugins. It requires me to extend classes and override its methods. The general structure looks similar the snippet below. Note that the function signature is fixed.</p>
  
  <p><code>ftp_client</code> is supposed to be shared by instances of both classes.</p>
  
  <pre><code>ftp_client = None
  
  class FtpFileCommand(sublime_plugin.TextCommand):
    def run(self, args):
      global ftp_client # does it reference the variable of the outer scope?
      self.ftp_client = ftplib.FTP('foo')
      # login and stuff
  
  class FtpFileEventListener(sublime_plugin.EventListener):
    def run(self, args):
      global ftp_client # same for this
      self.ftp_client.quit() # 
  </code></pre>
  
  <p>Both of these classes are supposed to have one variable in common. What is the best practice in order to share variables?</p>
  
  <p><strong>Edit</strong> based on madjars answer:</p>
  
  <p><code>FtpFileCommand.run</code> is called first, instanciates <code>ftp_client</code> and works like a charm. <code>FtpFileEventListener.run</code> is called later and, can reference <code>ftp_client</code> perfectly but it is still <code>None</code>. Using the global keyword, does it add the variable as a member to <code>self</code>?</p>