"David Poundall" <[EMAIL PROTECTED]> writes:
> I have several .py files in a directory that I would like to import at
> run time.  Each file contains a state machine that requires to be run
> in its own thread.

Imports happen at run time. Beware starting threads in the code run at
import time in each module, though - there are some nasty bugs lurking
there. Instead, start the threads in functions invoked from the main
routine.

> The first problem I have is how can I import the code in all of the .py
> files without knowing the file names in advance.
>
> Can this be done ??

Yes. Use the __import__ builtin.

     <mike
-- 
Mike Meyer <[EMAIL PROTECTED]>                  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to