[Pythonmac-SIG] Where am I ?

Jerry LeVan jerry.levan at eku.edu
Mon Sep 13 15:42:18 CEST 2004


Hi,

I am fairly new to python, there is a task I need to
figure out.

Suppose I have my "main" program in a folder, and various
support modules in *folders* in the same folder as the
main program.

How can I import stuff from the folders? Can I do this
so that if everything gets moved to  a new location,
the imports will still work?

In tcl I can do something like:

set basedir [file dirname [info script]]    <-- get the dir containing 
main
source [file join $basedir Support pgconnect.tcl] <-- load others...
source [file join $basedir Support Help.tcl]      <-- contained in
source [file join $basedir Support readme.tcl]    <-- basedir/support
source [file join $basedir Support tableInfo.tcl]

Thanks,

Jerry




More information about the Pythonmac-SIG mailing list