hy as long as there are no interferences : flip a right tool 180* + reverse spindle sense + feed towards chuck; pls find attached variants; sorry, i can't provide codes
if you can program a normal thread, then i think you should have no worries with it / kindly