How to call a script from another?

Scott David Daniels scott.daniels at
Thu Oct 13 17:36:20 CEST 2005

Jaime Wyant wrote:
> I think this is the simplest way to do that:
> import sys
> sys.path.append('/path/to/directory/containing/script')
> import zopescript
> zopescript.main()
> The code above assumes:
> o that the path you use to append contains an in it...
I don't think this is necessary.  The is necessary
if you do something like:
     import sys
     from script import zopescript
     # or import zopescript.script; script.zopescript.main()
That is, if the directory ".../containing" needs to be interpreted as
a package.

If the script you want to call is in the same directory as the script
calling it (or any directory on the path), you can simply use:
     import zopescript

--Scott David Daniels
scott.daniels at

More information about the Python-list mailing list