@ragol, I think Padraic has the right solution. Inside the python script that you are trying to run the hg commands, you need to include the following command: sys.path.insert(0,"/usr/lib/pythonVERSION")
Put the command at the very beginning of your python script. The command tells python to search in the /usr/lib/pythonVERSION when importing modules.
If this does not work, you may need a more specific path. For example, if the module you are trying to import is located in the /usr/lib/pythonVERSION/site-packages/hg directory, you can use the following command: sys.path.insert(0,"/usr/lib/pythonVERSION/site-packages/hg")
source share