Importing a module from a non-cwd

candide candide at free.invalid
Mon Oct 24 15:51:53 EDT 2011


Hi,

It's easy to open a file not located in the current working directory 
(cwd). But how about importing a module?

For instance, suppose I have a file, say my_file.py, located in the cwd, 
say /home/candide/ and suppose the module to be imported, say 
my_module.py, is located in the /home/candide/foo/ directory.



How my_file.py can import the my_module.py module ?

Thanks



More information about the Python-list mailing list