title: Mocking a function called inside another function inside a class python
body: <p>I need to mock a function(this_function()), that is called inside another function(receive()), inside a function blueprint, inside a class A.  How can I do it?
  I create a mock for this_function() in the file where i have all tests.</p>
  <pre><code>class A: 
         def blueprint(): 
             @route(&quot;/&quot;, method = [&quot;POST&quot;])
             async def receive(): 
                    ....
                test = await this_function()
  </code></pre>
  <p>I created a mock function in the same file as my test:</p>
  <pre><code>def mock_this_function(): 
     return ..
  
  class Tests(unittest.TestCase): 
     @patch(&quot;path.to.classA.this_function&quot;)
      def test(mock_this_function):
  </code></pre>
  <p>This_function is defined in a helper.py module.</p>
  <p>I'm not able to connect/use mock_this_function. It always connect me with this_function... Any solution? any Tips how to properly mock it?</p>