The title might be misleading or inaccurate, so please correct me if I'm wrong.
I have a package structured like this:
common
    __init__.py
foo.py
And here are the codes:
common/__init__.py
name = 'name_common'
def print_current_file_name():
    print('current file name: ' +  __file__)
def print_name():
    print('name is: ' + eval('name'))
foo.py
from common import print_current_file_name, print_name
name = 'name_foo'
if __name__ == '__main__':
    print_current_file_name()
    print_name()
If I do this:
>>> python foo.py
I'll get this:
current file name: /tmp/common/__init__.py
name is: name_common
But I expect the results to be:
current file name: /tmp/common/foo.py
name is: name_foo
What did I miss? How can I make this right? I don't even know which keywords should I google...
The use of eval is weird, but these codes are just for demonstration purpose only.