__init__.py file

cesco fd.calabrese at gmail.com
Tue Apr 8 22:51:21 CEST 2008


I need to instantiate an object (my_object) whose methods I have to
use in two files (file1.py and file2.py) which are in the same
directory. Is it possible to instantiate such object in the
__init__.py file and then directly use it in file1.py and file2.py?
If not, as I seem to experience, what is the best practice to follow
in this case? (I thought __init__.py was somehow useful for that).

Many thanks

More information about the Python-list mailing list