Another form of dynamic import

Anton Hartl anton.hartl+news at
Wed Mar 25 20:31:56 CET 2009

On 2009-03-25, Marco Nawijn <nawijn at> wrote:
> Hello,
> In short I would like to know if somebody knows if it is possible to
> re-execute a statement that raised an exception? I will explain the
> reason by providing a small introduction on why this might be nice in
> my case
> and some example code.
> I am using the python bindings to a *very* large C++ library. About
> 5000 classes divided over approx. 450 different
> packages are exposed through the Python interface. To reduce the
> number of import statements that need to be inserted and to limit the
> number of wildcard imports it would be very helpful if class names
> could be automatically imported from the proper module. There is no
> problem in finding out the proper module given a (valid) class name.

Maybe this helps:


More information about the Python-list mailing list