% engine=luatex
\externalocp\OCPbidi=do_bidi.py {}
     \ocplist\bidi=
     \addbeforeocplist 100 \OCPbidi
     \nullocplist
\pushocplist\bidi

\pardir TRT
\textdir TRT

Hello world. % this should appear LTR despite \textdir
\bye
