When you run the code, modules you imported will be extended to pyc files (python compiled). Then you could compile the root file with
>>> import py_compile
>>> py_compile.compile('abc.py')
You can pass these along to clients instead. However there are python uncompilers. Which can reverse this and see the code.
You could build an exe from it with py2exe, pyinstaller, cxfreeze , etc.
However exe's source can be viewable too. Thats how triple AAA games and high end programs get pirated.
Another other option is to obfuscate your code. Or you can write portions in c/c++ and compile it and import it in python.
You can also license it. It will stop tsome folks, but some just wont care.
Python wasnt made to have it code hidden. Its open source and good for open source applications.
https://wiki.python.org/moin/Asking%20fo...%20code%3F