title: Getting NameError when calling function in constructor
body: <p>I ran the code below, by calling the function in the constructor </p>
  
  <p>First --</p>
  
  <pre><code>&gt;&gt;&gt; class PrintName:
  ...    def __init__(self, value):
  ...      self._value = value
  ...      printName(self._value)
  ...    def printName(self, value):
  ...      for c in value:
  ...        print c
  ...
  &gt;&gt;&gt; o = PrintName('Chaitanya')
  C
  h
  a
  i
  t
  a
  n
  y
  a
  </code></pre>
  
  <hr>
  
  <p>Once again I run this and I get this</p>
  
  <pre><code>&gt;&gt;&gt; class PrintName:
  ...    def __init__(self, value):
  ...      self._value = value
  ...      printName(self._value)
  ...    def printName(self, value):
  ...      for c in value:
  ...        print c
  ...
  &gt;&gt;&gt; o = PrintName('Hello')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "&lt;stdin&gt;", line 4, in __init__
  NameError: global name 'printName' is not defined
  </code></pre>
  
  <p>Can I not call a function in the constructor? and whay a deviation in the execution of similar code?</p>
  
  <p>Note:  I forgot to call a function local to the class, by using self (ex: self.printName()). Apologize for the post.</p>