Is There A Way To Import Multiple Modules Under One Alias?
I'm trying to import multiple library files under a single alias, without the use of the init.py file (because it's apparently not supported by ROS). Example: Let's say we have the
Solution 1:
No.
One symbol in a script cannot refer to multiple modules at the same time.
And using different names for different modules is a much cleaner approach anyway. You can try to make your life a bit easier by using the wildcard import
from foo.aimport *
from foo.bimport *
from foo.cimport *
fn1()
fn2()
fn3()
But this ends up polluting your namespace. I wouldn't recommend it.
Solution 2:
You could also try it (*
not recommended):
from foo.a import fn1
from foo.b import fn2
from foo.c import fn3
fn1()
fn2()
fn3()
Post a Comment for "Is There A Way To Import Multiple Modules Under One Alias?"