[wingide-users] global imports

Mclam, GeorgeX georgex.mclam at intel.com
Thu Jun 9 12:43:33 MDT 2011


Thank you very much for your help in this matter.  I was able to take
one of your comments/examples and develop a solution to my situation.

You wrote:

> If you really truly care about not having that extra level of
> indirection, try the moral equivalent of this (and careful that you
> don't copy too much -- you might want to skip everything with a "__"
> prefix)
> def init(a, b, c):
>   for module in a,b,c:
>    globals().update(module.__dict__)

And from that I came up with:

# ----- Module Initialization ----------
def fnInitSubroutines(sC,sE,sP):
    exec "from " + sC + " import *"     # Configuration of test equipment
    exec "from " + sE + " import *"     # Lists of user Equipment settings
    exec "from " + sP + " import *"     # Lists of user test Parameters

The only changes to subroutines.py is the addition of the above function
and removal of the (3) existing import statements.

The only change to the main project modules is to import subroutines
instead of the copied/altered version and a call to the above function.

This is the solution I was looking for.
Best regards,
George McLam

More information about the wingide-users mailing list