title: python mocking a function call during module import in test file
body: <p>I'm trying to mock a function call that executes when a module is imported, below is the sample of the issue that I'm having</p>
  
  <p><code>app/module.py</code></p>
  
  <pre><code>    from util import get_param 
  
      PARAM = get_param('param_name')
      class sample():
           def run_sample(self):
               print(PARAM)
  </code></pre>
  
  <p><code>app/tests/test_module.py</code></p>
  
  <pre><code>from app import module
  import unittest
  
  class TestSample(unittest.TestCase):
      @mock.patch('app.module.get_param')
      def test_run_sample(self, mock_get_param):
          test_obj = module.sample()
          test_obj.run_sample()
  </code></pre>
  
  <p>This doesn't work and it calls the original get_param method instead of mocking it. </p>