title: Python: calling a child function using a string
body: <p>Does anyone know how to call a child function that belongs to a parent function using the dot operator, but where the child function's name is stored in a string variable.</p>
  <pre><code>def parent_function():
     # do something
     def child_function():
        # do something else
  </code></pre>
  <p>Now imagine I have a string called 'child_function'. Is there a way to do this:</p>
  <pre><code>method_name = 'child_function'
  parent_function.method_name()
  </code></pre>
  <p>I understand that method_name is a string and so it is not callable. The syntax above is clearly wrong, but I wanted to know if there was a way to do this?</p>
  <p>Thank you!</p>