The dotted notation is used for relative imports, meaning relative to a path in
sys.path. lxml is installed in my user
site-packages directory - there it is at the bottom on my system:
C:\Users\tom>py -c "import sys;print('\n'.join(sys.path))"
C:\Users\tom\AppData\Local\Programs\Python\Python312\python312.zip
C:\Users\tom\AppData\Local\Programs\Python\Python312\DLLs
C:\Users\tom\AppData\Local\Programs\Python\Python312\Lib
C:\Users\tom\AppData\Local\Programs\Python\Python312
C:\Users\tom\AppData\Roaming\Python\Python312\site-packages
C:\Users\tom\AppData\Roaming\Python
C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\win32
C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\win32\lib
C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\Pythonwin
C:\Users\tom\AppData\Local\Programs\Python\Python312\Lib\site-packages
lxml.html means find the lxml package and then the html subpackage relative to it (change paths for your system) starting at
C:\Users\tom\AppData\Local\Programs\Python\Python312\Lib\site-packages.
You can use dotted paths if your import subdirectories are set up right, which they are with lxml (change paths to suit your system) -
import lxml.html
PATH = r"C:\temp\freemind\basic_freemind.xml"
htmltree = lxml.html.parse(PATH)
print(htmltree)
or this -
import lxml.html as html
PATH = r"C:\temp\freemind\basic_freemind.xml"
htmltree = html.parse(PATH)
print(htmltree)
Read Sec 5.2 of the Python docs at