dynamic loading of modules in plugins?

Robert Collins robertc at robertcollins.net
Fri May 11 07:00:19 BST 2007


On Fri, 2007-05-11 at 15:43 +1000, Ian Clatworthy wrote:
> I'm had a bit more trouble than I hoped for getting dynamic loading
> of 
> modules working inside a bzr plugin. This worked fine:
> 
>   import scripts.script_common
>   return scripts.script_common.script_suite()
> 
> But this didn't:
...
> Is this behaviour expected or a side effect of how we implement lazy 
> importing of modules?

__import__ can be tricky to work with. I would tend to do
exec "from scripts.script_common import script_suite" 
as its just less mucking around.

-Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070511/fae24daf/attachment.pgp 


More information about the bazaar mailing list