Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin loader tries to load every file in the plugin directory, not every module #415

Open
rsalmond opened this issue Sep 5, 2019 · 1 comment

Comments

@rsalmond
Copy link
Collaborator

rsalmond commented Sep 5, 2019

While developing a plugin I discovered that the plugin loader system is recursively calling imp.load_module() on every file it finds under the PLUGIN_PATH, not every directory / module. Because of this __init__.py is not always parsed prior to other code in the module.

I'm cutting an issue instead of a PR because I can't think of a situation where doing module imports rather than file imports would break something but I want to get some second opinions because maybe I'm just not very imaginative.

@BrianGallew
Copy link
Contributor

The only negative is that if you import a module you must avoid name collisions. That's not usually a big deal, but can occasionally bite people. One benefit is that it would let plugins reference each other more easily. It's probably more because of my poor coding skills, but I occasionally end up in situations where I have two separate plugins, each with distinct configs, that would really like to reference each other. Sure, you can use @route() to provide a kind of back channel, but I'm not a fan of that.

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

No branches or pull requests

2 participants