Never heard of rlwrap before. Neat!

readline seems to be incompatible with Windows:

error: this module is not meant to work on Windows

But there is a workaround: pyreadline3 module.

# Source - https://stackoverflow.com/a/51964654
# Posted by Lefteris Xris, modified by community.
# See post 'Timeline' for change history.
# Retrieved 2025-12-12, License - CC BY-SA 4.0

from pyreadline3 import Readline
readline = Readline()