I have a directory structure that contains different modules that run
depending on what the user selects. They are identical in name and
structure, but what varies is the content of the functions. They will
only need to be run once per execution.

Example (directory level):
Sys1:
      A
      B
      C
Sys2:
      A
      B
      C
Sys3:
      A
      B
      C
Sys4:
      A
      B
      C

So if the user selects Sys1 during execution, I want to import the
modules using "from *" and the run the content of those files.

Now the way my program is set up, it is very important that I be able
to "from Sys1 import *" and not "import Sys1". The names of the
functions inside are passed in from somewhere else and the program
requires those function names to be globally scoped.

So I have a function that looks like this:

def importModules( type ):
    cwd = os.getcwd()
    path = cwd + "\\" + type
    sys.path.append(path)

    from security import *

Obviously this is not working and I get a syntax error at runtime. So
without this functionality, how do I target modules to import in other
directories after program execution has begun?

Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to