Fix Python – What does a . in an import statement in Python mean?

Question

Asked By – Vlad the Impala

I’m looking over the code for Python’s multiprocessing module, and it contains this line:

from ._multiprocessing import win32, Connection, PipeConnection

instead of

from _multiprocessing import win32, Connection, PipeConnection

the subtle difference being the period before _multiprocessing. What does that mean? Why the period?

Now we will see solution for issue: What does a . in an import statement in Python mean?


Answer

That’s the syntax for explicit relative imports. It means import from the current package.

This question is answered By – Keith

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0