Let's say you have this structure: a\ __init__.py b\ __init__.py In `b.__init__` a function called `my_function` is defined. And assume that `a` and `b` are both on `sys.path`. Then this situation happens: >>> import a.b >>> import b >>> a.b.my_function is b.my_function False >>> a.b.my_function <function my_function at 0x00BC70C0> >>> b.my_function <function my_function at 0x00BC7108> >>> a.b.my_function.__module__ 'a.b' >>> b.my_function.__module__ 'b' It seems that `a.b.my_function` and `b.my_function` are different objects.
Benjamin, This behavior is involved in a problem I have with Django. When using Django, you have apps that live inside a project: my_project\ __init__.py my_app\ __init__.py views.py So if you have a view function in `views.py`, it will have two separate identities, and that causes problems. Do you have an idea what I can do about it?