This library utilizes pymem and hypno in order to support injecting python shellcode to arbitrary processes. Difference of this library from these libraries is that pyshellcode fixes the bugs of both libraries so that you won't face crashes because of injecting to processes that are incompatible with one of those libraries. Pymem can only inject into non-python processes and hypno can only inject into python processes. Additionally pymem doesn't work on newer python versions as it is discussed here.
pip install pyshellcode
pyshellcode.inject_py(pid_or_name, shellcode)
pid_or_name can either be a str representing the name of the process or an int representing its pid. shellcode is the string that will be executed in the remote process.