Dynamic module/package import ???

JB jimbag at kw.igs.net
Thu Jan 13 11:55:01 EST 2000


I'm trying to import a module from a package dynamically. The layout is
like so...

/DataHandler
  |- DataRow.py
  |- MyReader.py
  |- __init__.py

In class DataRow.DataRow I try...

  def setReader( self, reader )
    mod = __import__( 'DataHandler.' + reader + 'Reader' )

... but this just loads the __init__.py, so it seems that the __import__
doesn't understand packages or something.

Any help?

cheers
jim



More information about the Python-list mailing list