include in python
Irmen de Jong
irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Mon May 5 05:44:08 EDT 2003
Bartek Golenko wrote:
> Hello,
>
> I'm wondering if there is a way to simply include one python script
> into another (like #include in C or source in sh).
>
> I want to divide my program into smaller files, but I would prefer not
> to use import (as it results in a separate namespaces for each module and
> there are some interactions between them that I do not wish to cope with
> right now).
You should, eventually. Fire up a python shell and type "import this"
and read the last line :-)
Anyway, you could do
from your_module import *
This loads the contents of your_module.py in the current namespace.
--Irmen
More information about the Python-list
mailing list