Multiple files

Benjamin Kaplan benjamin.kaplan at case.edu
Sat Oct 17 22:05:53 EDT 2009


On Sat, Oct 17, 2009 at 9:58 PM, Someone Something <fordhaivat at gmail.com> wrote:
> I was trying to write a program with just one class and it was working fine.
> Then, I seperated that class into two different files and made the objects
> and called the methods in a third (client.py IO.py main.py). Now, when I use
> the command:
>
> python client.py IO.py main.py
>
> Nothing prints. I think its only interpreting client.py (the objects are
> declared in main.py)
>
> How can I fix this?

Python is a scripting language that compiles files as needed. You
don't need to declare every module you're using Run only the script
you need.

python main.py

When the script is run, the current directory is automatically added
to the python path, the list of directories python looks through for
modules (stored in sys.path). When python sees "import client", it
looks through that path for client.py and then compiles it if it's not
already been compiled.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>



More information about the Python-list mailing list