title: Dynamically assign class object to function
body: <p>following @MisterMiyagi comment(Thanks!),</p>
  <p>I rephrase my unclear previous question with (hopefully) better/shorter example.</p>
  <p>In main script ,
  I initialize obj with Class Exmaple .
  I pass test as **kwargs to class ,
  Next, I call the function with intention to assign self.test using curr_test</p>
  <p>Expected:
  self.test will print &quot;test&quot;
  actual:
  it didn't work, result holds &quot;test&quot; but it didn't assign any change to self.test.</p>
  <p>main:</p>
  <pre><code>from my_class import example
  
  obj = example(test = &quot;&quot;)
  
  obj._Test(obj.test)
  
  print(len(obj.test))
  
  
  # prints &quot;0&quot; expected &quot;test&quot;
  
  
  </code></pre>
  <p>class:</p>
  <pre><code>class example:
      
      def __init__(self, **kwargs):
          self.__dict__.update(kwargs)
          self.kwargs = kwargs
          
      def _Test(self, curr_test = ''  ):
          curr_test = 'test'
          print(&quot;curr_test :&quot;,curr_test ,&quot;class test:&quot;,self.test)
  </code></pre>