In Python the from A import C syntax looks for the module/file A, grabs C, and puts it into your namespace. What exactly A is is complicated and can very a lot; basically, it can be the name of a module/folder/file in either Python's module library or in the same directory as the script.
For example, if you ran this:
from my_module import add, subtract
This is what Python would do:
my_module.add and subtract.ModuleNotFoundError.C) is not found, it raises ImportError.So you can do this:
from my_module import add, subtract
add(1, 2)
When you do A.B, Python is targeting B, which is inside A. For example if you had this file structure:
| my_module [folder]
| -- __init__.py
| -- functions.py [contains add]
| -- other.py
If you ran from my_module.functions import add, Python is first locating my_module, then looking for functions, and then grabs add. The __init__.py file tells Python that this is a module folder and gets run at import time. That file is not essential in Python 3.x, but it is recommended. (There are also other ways to do this, such as setup.py and packaging it with a distributor, but __init__.py is the most modern and recommended way.)
With the setup above, if you tried to do this:
from my_module import add
...you'd get an ImportError because add is not directly inside the my_module folder.
You can go even further and do this:
from my_module import add as renamed_add
renamed_add(1, 3)
(This will install add exactly the same, but it's imported as renamed_add instead.
As for how do install qpid_messaging and qpid, I recognize them vaguely, but I haven't done anything with them personally. you can try running pip install qpid and pip install qpid_messaging in your terminal, if qpid is in the PyPI. If that throws an error or hangs forever, you can maybe look on GitHub or Apache's website for it. When you find it, put it in your site-packages folder. To find the location of your site-packages folder:
import site
print(site.getsitepackages())
(You can do that in an REPL if you don't want to save a file just for that.)