dynamic import with heritage

marco manatlan at online.fr
Thu Jun 10 23:21:16 CEST 2004


i try to make a dynamic import of a plugin which herits from another class

here my main:
-------------------------------------------------------------------
class bidon:
	pass

plugin = __import__( "plugins.dhuile" , globals(), locals())
-------------------------------------------------------------------

And in the file /plugins/dhuile/__init__.py, i've got :
-------------------------------------------------------------------
class vidange(bidon):
     def test():
         return "ok"
-------------------------------------------------------------------

python2.3 gives me :
"__init__.py : NameError: name 'bidon' is not defined"

i don't understand where is the mistake ?!
(class "bidon" is in passed by the globals() ... but it seems 
__init__.py doesn't understand)

anybody have got an idea ?
thanx



More information about the Python-list mailing list