Skip to content

Fix 'reference to a variable html' error on interview load - #1096

Merged
nonprofittechy merged 1 commit into
mainfrom
fix/al-visual-html-import
Aug 20, 2026
Merged

Fix 'reference to a variable html' error on interview load#1096
nonprofittechy merged 1 commit into
mainfrom
fix/al-visual-html-import

Conversation

@nonprofittechy

Copy link
Copy Markdown
Member

Problem

Since #1095 (1f7b7cb), loading any interview that includes al_visual.yml fails with:

Interview has an error. There was a reference to a variable 'html' that could
not be looked up in the question file (for language 'en') ...

Cause

That PR added:

modules:
  - json
  - html

In docassemble, modules: performs from <module> import *. That pulls in the module's public names (escape, unescape, dumps, ...) but never binds the module name itself. So the html.escape(...) call in the al_menu_items_default_items data from code block had no html in scope, and docassemble tried to resolve it as an interview variable. json.dumps would have failed the same way right after.

Fix

Use imports:, which does import <module> — matching how ql_baseline.yml and al_settings.yml already import humanize and importlib.

🤖 Generated with Claude Code

`modules:` performs `from <module> import *`, which never binds the
module name itself, so `html.escape(...)` and `json.dumps(...)` in the
al_menu_items_default_items block raised "reference to a variable 'html'
that could not be looked up". `imports:` does `import <module>`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@nonprofittechy
nonprofittechy merged commit c477530 into main Aug 20, 2026
8 checks passed
@nonprofittechy
nonprofittechy deleted the fix/al-visual-html-import branch August 20, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant