[Tutor] use my own code
Evert Rol
evert.rol at gmail.com
Sun Nov 25 18:42:31 CET 2007
> I have some .py files that have things I need to use, sometimes
> it's the functions and sometimes it's the whole .py (they have no
> functions)
>
> how do I use them in my other .py codes?
Import them at the top of your other .py file(s):
import <yourfile>
(without the .py extension).
If they're in the current directory, you're fine. Otherwise you may
need to set the PYTHONPATH variable.
See chapter 6 in the Python tutorial, especially section 6.1.1:
http://docs.python.org/tut/node8.html#SECTION008110000000000000000
Evert
More information about the Tutor
mailing list