Python change module name to its realname
Question: `app.py`:

    
    
    import sys
    
    for name, module in sys.modules.iteritems():
        print name
    

I get:

    
    
    encodings
    site
    __builtin__
    sysconfig
    __main__
    ....
    

as you can see, the module name is changed to `__main__`.

I know this behaviour(`if __name__ == '__main__'`), but how can I change the
module name back to its real name?


Answer: Take a look at `module` for your module:

    
    
    print module
    

Output:

    
    
    <module '__main__' from 'app.py'>
    

