Hi Michael,
Thank you for your code in https://michaelyou.github.io/2015/06/13/python%E4%B8%AD%E5%AE%9A%E4%B9%89%E5%B8%B8%E9%87%8F/ ;
And I found there is an issue when I really use your code, and when I search it on stackoverflow, someone has already submit a question on it.
https://stackoverflow.com/questions/5365562/why-is-the-value-of-name-changing-after-assignment-to-sys-modules-name
You can take that for reference.
Best regards,
Lin