title: Prevent 'try' to catch an exception and pass to the next line in python
body: <p>I have a python function that runs other functions. </p>
  
  <pre><code>def main():
      func1(a,b)
      func2(*args,*kwargs)
      func3()
  </code></pre>
  
  <p>Now I want to apply exceptions on <code>main</code> function. If there was an exception in any of the functions inside main, the function should not stop but continue executing next line. In other words, I want the below functionality </p>
  
  <pre><code>def main():
      try:
          func1()
      except:
          pass
      try:
          func2()
      except:
          pass
      try:
          func3()
      except:
          pass
  </code></pre>
  
  <p>So is there any way to loop through each statement inside <code>main</code> function and apply exceptions on each line. </p>
  
  <pre><code>for line in main_function:
      try:
          line
      except:
          pass
  </code></pre>
  
  <p>I just don't want to write exceptions inside the <code>main</code> function.</p>
  
  <p>Note : <a href="https://stackoverflow.com/questions/10898873/how-to-prevent-try-catching-every-possible-line-in-python">How to prevent try catching every possible line in python?</a> this question comes close to solving this problem, but I can't figure out how to loop through lines in a function. </p>
  
  <p>If you have any other way to do this other than looping, that would help too.  </p>