Changing the permissions as indicated by Sergio would be enough if you do not have physical access to the RPi (it would be enough to read the memory card from another computer with root access to access your code).
You will need to obfuscate the code so that no one can read / edit it.
Unfortunately, Python is not the ideal language to obfuscate the code, since its philosophy is that everything is an open source code.
You could try to precompile all the code in bytecode, delete the .py and distribute the .pyc. To precompile the code, you can use:
python -m compileall .
Even so, it would not be complicated to decompile the code, but it is one more barrier.
A more effective solution may be to use Cython to convert the Python code to C and then compile it with gcc, and thus create dynamic libraries that can be used as importable modules. Take a look at your documentation .