"sourcing" files

Harald Kirsch kirschh at lionbioscience.com
Wed Jan 16 03:29:25 EST 2002


18k11tm001 at sneakemail.com (Russ) writes:

> Tcl/Tk has a command called "source", which allows you to "include,"
> or paste in, the code from another file. That is, I can use
> 
> 	source anotherfile.tcl
> 
> to simply paste the code from anotherfile.tcl into the original file.
> Does Python have an equivalent capability? Thanks.

You could fiddle with execfile, like
  
  execfile("bla.py", globals())

however, my own experience shows that even in cases where you think
you are really sure you want that, you should reconsider the case and
then use import.

  Harald Kirsch

-- 
----------------+------------------------------------------------------
Harald Kirsch   | kirschh at lionbioscience.com | "How old is the epsilon?"
LION bioscience | +49 6221 4038 172          |        -- Paul Erdös
       *** Please do not send me copies of your posts. ***



More information about the Python-list mailing list