title: How to get parent attributes from a child method attribute in Python?
body: <p>i have this code: </p>
  
  <pre><code>def some_method():
      #i need to get some attrs :(
      return 'blabla'
  
  setattr(parent, 'new_attr', some_method)
  </code></pre>
  
  <p>it's there a way to get other attributes of the parent inside the <code>some_method</code> function?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Update: (solution)</strong></p>
  
  <p>I solved in this way, i don't know if the best.</p>
  
  <pre><code>def some_method(parent):
      # print or do something parent.xy_attribute
      return 'blabla'
  
  parent.new_attr = some_method(parent)
  </code></pre>
  
  <p>and it works!</p>
  
  <p>Thanks again!</p>