'How to explicit import from submodule of a builtin
Working with Python for Foundry Modo 3D application, and their Python SDK lx is a builtin module.
>>> type(lx)
"<class 'module'>"
symbol is a module in lx, which contains constants.
What I'm trying to do is run
from lx.symbol import sCATEGORY_TOOL
But this raises ModuleNotFoundError: No module named 'lx.symbol'; lx is not a package
It is all mostly to avoid having to type lx.symbol.i_VERY_LONG_CONSTANT_NAME
=== Edit ===
Ok, so it could be solved by doing
import lx
foo = lx.symbol.foo
bar = lx.symbol.bar
baz = lx.symbol.baz
...
But I think it seem much more clear if it would come as
from lx.symbol import foo,\
bar,\
baz,\
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
