From: Thomas Jollans on
On 2010-06-15 02:29, moerchendiser2k3 wrote:
> Hi, yes, that was my first idea when I just create an
> external module. I forgot something to say:
>
> In my case the initfoo() function is called on startup
> in my embedding environment, that means I call that
> on startup of my main app.
>
ah. In that case, I don't think it's possible to do anything on import -
AFAIK, if the module "foo" is already loaded/initialized, "import foo"
is equivalent to "foo = sys.modules['foo']" and doesn't invoke any
module-specific code...

You could issue a warning on each and every method call in your module,
so that when it's used, the user gets warned. Then you could cache
whether a warning has been issued already in a global static variable or
in module state to be able to only warn once.

Thomas