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

Imports are not lazy enough #9

Open
xiumingzhang opened this issue Jun 13, 2019 · 1 comment
Open

Imports are not lazy enough #9

xiumingzhang opened this issue Jun 13, 2019 · 1 comment

Comments

@xiumingzhang
Copy link
Owner

xiumingzhang commented Jun 13, 2019

Consider moving any non-basic imports into the functions.

This is not inefficient because imports are cached, and more importantly, helps reduce import failures.

If an import is pretty much necessary for all functions in the module (like import bpy to blender.object), wrap the import inside try, so it won't fail at init time (deferring failure till the use time).

@xiumingzhang xiumingzhang changed the title Imports are not "passive" enough Imports are not lazy enough Jun 14, 2019
@xiumingzhang
Copy link
Owner Author

I reiterate:
If an import is pretty much necessary for all functions in the module (like import bpy to blender.object), wrap the import inside try, so it won't fail at init time (deferring failure till the use time).

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

1 participant