title: Python introspection - how to check current module / line of call from within function
body: <p>I have a function:</p>
  
  <pre><code># utils.py
  def hello(name='World'):
      # Detect where I'm being called from.
      print('Hi, %s. You called this from %s at line # %d.' % (name, mod, lineno))
      # ``mod`` and ``lineno`` on previous line would have been set in real use.
  </code></pre>
  
  <p>I import that function and run it elsewhere</p>
  
  <pre><code># other.py (this comment at line # 138)
  from utils import hello
  hello('Johnny')  # From inside ``hello`` I want to be able to detect that this
  # was called from other.py at line # 140
  </code></pre>