If you're using preprocessors and you're on Linux, then instead of ".rd" you could try
.so /dev/tty and terminate keyboard input with end-of-file (usually control-d) or ".nx" on a line by itself. Example: echo -e '.pl 10\nFoo\n.so /dev/tty\nbar\n.so /dev/tty\nbaz' | groff -Tascii and then enter on your keyboard yes .nx no .nx which will result in Foo yes bar no baz