PyDocs

Nav

Python Runtime Services

remote_exec

sys

function · Added in 3.14UnixWindows
  • remote_exec(pid, script)
Executes a file containing Python code in a given remote Python process.

This function returns immediately, and the code will be executed by the
target process's main thread at the next available opportunity,
similarly to how signals are handled.  There is no interface to
determine when the code has been executed.  The caller is responsible
for making sure that the file still exists whenever the remote process
tries to read it and that it hasn't been overwritten.

The remote process must be running a CPython interpreter of the same
major and minor version as the local process.  If either the local or
remote interpreter is pre-release (alpha, beta, or release candidate)
then the local and remote interpreters must be the same exact version.

Args:
     pid (int): The process ID of the target Python process.
     script (str|bytes): The path to a file containing
         the Python code to be executed.
0 Examples
No examples for sys/remote_exec.
See Also
No see-alsos for sys/remote_exec
0 Notes
No notes for remote_exec