Support nested imports, closes #351

This commit is contained in:
Simon Willison 2021-12-10 16:11:22 -08:00
commit 7a43af232e
3 changed files with 28 additions and 1 deletions

View file

@ -2137,7 +2137,7 @@ def convert(
locals = {}
globals = {"r": recipes, "recipes": recipes}
for import_ in imports:
globals[import_] = __import__(import_)
globals[import_.split(".")[0]] = __import__(import_)
exec(code_o, globals, locals)
fn = locals["fn"]
if dry_run: