Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment: You need to set the __module__ attribute. B.__module__ = __name__ ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report at bugs.python.org> <https://bugs.python.org/issue35510> _______________________________________