title: passing variables between classes in python
body: <p>I have the following code:</p>
  
  <pre><code>class VM():
      def __init__(self):
          global vmitems,vmappid
          vmitems = {'url' : 'stuff','vmid' : '10'}
  
      def create(self, **vmitems):
             appurl = vmitems.get('url')
             vmappid   = vmitems.get('vmid')
             vmitems.update(vmid=vmappid)
             vmitems.update(url=appurl)
             print 'New URL: '+appurl
             print 'New ID: '+vmappid
             print 'NEW LIST: ',vmitems
             return vmitems
  
      def delete(self, **vmitems):
             appurl = vmitems.get('url')
             vmappid   = vmitems.get('vmid')
             print 'do stuff'
  
  action = VM()
  action.create(url='https://www.google.com', vmid='20')
  action.delete(url='urlhere',vmid='20')
  print 'New List: ',vmitems
  </code></pre>
  
  <p>I was wondering if anyone can tell me how would I pass the value of <code>vmitems</code> around to other classes/functions </p>
  
  <p>UPDATE: Corrected. Issue was not using self and not passing them around (sorry still learning and new to python).</p>
  
  <pre>
  
      class VM():
          def __init__(self):
              self.vmitems = {'url' : 'stuff','vmid' : '10'}
  
          def create(self, **vmitems):
             print 'Original: ',self.vmitems
             appurl = vmitems.get('url')
             vmappid   = vmitems.get('vmid')
             self.vmitems.update(vmid=vmappid)
             self.vmitems.update(url=appurl)
             print 'New URL: '+appurl
             print 'New ID: '+vmappid
             print 'NEW LIST: ',vmitems
             return self.vmitems
  
          def delete(self):
             print 'Before Delete: ',self.vmitems
             self.vmitems.update(vmid='30')
             self.vmitems.update(url='newurl')
             return self.vmitems
  
          def shownow(self):
              print 'After Delete: ',self.vmitems
  
  </pre>