|
Ralf Schoenian |
at Aug 6, 2010 at 6:05 am
|
⇧ |
| |
Navkirat Singh wrote:
Hi guys,
I am new to python and would like to import certain classes in sub-directories of the working directory. I was wondering how will I be able to achieve this?
Regards,
Nav
Hi,
put an empty file with the name __init__.py in your subdirectory. I call
it sub1 here. Assuming your filename is importme.py and your classname
is Test you can do the following imports:
from sub1.importme import Test
import sub1.importme
You can find further explainations in the official tutorial
http://docs.python.org/tutorial/modules.htmlRegards,
Ralf