Move import logic to a separate function.

The __import__ function is defined super-globally.
Optimisation when importing several items.

Store the result from the __import__ call in a temporary variable
and assign local values from that.