Get full package module name Get full package module name python python

Get full package module name


__name__ always contains the full name of the module. (Other than __main__ on main, of course.)


Try using the __name__ attribute of the module.


A simple way of retrieving the full module name within its package:

print(__file__)