Fix `from x import y` inside functions.
This also allows cyclical imports using `from x import y` inside functions (in addition to the `import x` which was already allowed).
@@ -2076,7 +2076,8 @@ class Generator (ast.NodeVisitor):
if index < len (module.all) - 1:
self.emit (';\n')
- # And export everything imported
+ if type (self.getScope ().node) == ast.Module:
+ # And export everything imported, if we are not importing inside of a function.
self.all.update (module.all)
else:
# Import something
