I think it should work nearly the way you described it. The only thing you forgot is to close the pipe, so that your lines are actually processed by gnuplot. Can't test it on Windows at the moment, but on Linux the following works fine (only thing changed is the added last line):
import subprocess
proc = subprocess.Popen(['Patho to gnuplot executable','--persist'],
shell=False,
stdin=subprocess.PIPE,
)
proc.stdin.write(b'set xrange [0:10]; set yrange [-2:2] \n')
proc.stdin.write(b'plot sin(x) \n')
proc.stdin.write(b'quit \n')
proc.stdin.close()
Edit to answer the second "question" (please do not post your clarifications as answers, simply comment or edit your initial question):
There should not be a default "Popen" function. It seems to me that you have imported it in a different way than in your code snippet. For example
from subprocess import Popen
would import only the Popen module but directly into the symbol table of your python program (instead of the subprocess module). Refer to e.g. https://docs.python.org/3/tutorial/modules.html for more informations.