Repository navigation
fix: import add-in modules relatively to avoid cross-add-in collisions - #13
Merged
Merged
Conversation
Fusion runs every add-in in a single Python interpreter. The entry point added the add-in folder to sys.path and imported its code as the top-level package `lib`. Any other add-in with a `lib` package could therefore shadow ConstraintLens's modules, or have its own shadowed, depending on load order. When that happens one add-in runs the other's code: ConstraintLens's lifecycle.start() was observed running against another add-in's folder. Import from the add-in's own package instead (`from .lib import lifecycle`), matching Autodesk's add-in template, and leave sys.path untouched. Nothing under lib/ changes; it already imports relatively. The headless tests now import `ConstraintLens.lib` the way Fusion loads it, and test_entry.py checks the entry point resolves its own `lib` when another add-in's is already imported.
Owner
|
Thanks, Craig. This was a great catch and a really clean PR, and the regression test made it easy to review. I tested it in Fusion before merging, and it ships in v1.6.6. Good luck with Fusion Keypad! |
Botrops1
added a commit
that referenced
this pull request
Oct 1, 2026
Bump the manifest to 1.6.6 and add its release-notes section, crediting @craigulliott for the fix merged in #13. CLAUDE.md: v1.6.5 is released, the outstanding steps now cover tagging and publishing v1.6.6, the headless test count is 35, and a v1.6.6 entry records why the entry point must never go back to a sys.path insert plus an absolute lib import. Claude-Session: https://claude.ai/code/session_01FxxsWx1gqvDYC3S6YChoEw Co-authored-by: Claude <noreply@anthropic.com>
1 of 2 tasks
Botrops1
added a commit
that referenced
this pull request
Nov 27, 2026
## Summary The `v1.6.6` tag points at `64df593` (the PR #13 merge), one commit before the version bump in `ed13909`. The release ZIP is built from the tag, so it shipped a manifest reading `1.6.5` (issue #15). The tag is protected by a repository ruleset and cannot be moved, so this releases a new version with identical code. - `ConstraintLens/ConstraintLens.manifest`: `1.6.6` → `1.6.7` - `RELEASE_NOTES.md`: new v1.6.7 section (packaging fix, credits @DiegoV71 for the report and #16) - `CLAUDE.md`: status and release steps updated; records that published tags cannot be moved No code under `ConstraintLens/lib/` or `palette/` changes. ## Test plan - [x] `python3 -m unittest discover` in `tests/headless` — 35 tests pass - [ ] After merge: tag the merge commit as `v1.6.7`, run `python scripts/package_release.py v1.6.7` (refuses if the tag's manifest is not 1.6.7), publish the release with that ZIP Related to #15. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I found this because my own add-in, Fusion Keypad (it drives a Logitech MX Keypad from Fusion), was doing exactly the same thing. It added its folder to sys.path and imported its code as lib. With both add-ins running, mine picked up ConstraintLens's lib.lifecycle instead of its own. ConstraintLens's start() then ran against my add-in's folder, and the palette icons ended up copied in there. It confused me for a while!
Fusion runs every add-in in the same Python interpreter, so whichever add-in imports lib first wins, and the other gets its code. Autodesk's own add-in template avoids this with relative imports (from .lib import …). I've switched mine to that, and this PR makes the same small change here, so ConstraintLens can't be caught by, or catch, another add-in that uses the same pattern.
Nothing under lib/ needed to change, since it already imports relatively. I've also added a small test that loads the entry point while another add-in's lib is already imported. It fails with the old import and passes with the new one, and all the headless tests and lint pass.
Thanks for ConstraintLens, it's been really useful. Happy to adjust anything.