you may consider cloning my fork of python-nostr and implementing the auth pattern
Kind 1 event gets published but cannot find Kind 4 event on that relay published by publish_dm_event()
What could be the reason? Here's the python script if you want to test: https://pastebin.com/raw/dNFNB9XF
You will have to clone [python-nostr](https://github.com/jeffthibault/python-nostr) and save this python script inside python-nostr directory to run it

Discussion
to clarify, after connect and publish, check the auth messages for any challenge. if challenge presented by relay, perform challenge response and then republish original message to that same relay