double import protection - how to ?

Helmut Jarausch jarausch at skynet.be
Sat Nov 29 07:43:45 EST 2008


Hi,

sorry if this is a FAQ (I couldn't find an answer)

I have a module which gets imported at several different places
not all of which are under my control.

How can I achieve that  all/some statements within that module
get executed only at the very first import?
(the statement which must be executed only once, initializes
another OS-thread (java in my case))

Many thanks for a hint,

Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



More information about the Python-list mailing list