include a python class in another python script.

sjdevnull at yahoo.com sjdevnull at yahoo.com
Tue Aug 15 16:52:26 EDT 2006


KraftDiner wrote:
> I have a class that is defined in a file called MyClass.py
>
> How do I use that class in another python script..
> import MyClass ?  (Does it need to be in a specific location?)

Same directory as the script that's importing it, or in the PYTHONPATH.

import sys
print sys.path




More information about the Python-list mailing list