I'm in Python, and I'd like to do from foo.bar import baz but programmatically. i.e., I will know the name "baz" at runtime, and I have it in the value of a variable. How do I do that?
Asked
Active
Viewed 44 times
1
Ram Rachum
- 77,567
- 79
- 223
- 360
-
2Does this answer your question? [How do I import variable packages in Python like using variable variables ($$) in PHP?](https://stackoverflow.com/questions/6677424/how-do-i-import-variable-packages-in-python-like-using-variable-variables-i) An old solution, but the second answer imports correctly. – bbnumber2 Nov 23 '20 at 16:11