Some dependency somewhere must have imported xmlrpc.client before you did. If any code imported xmlrpc.client, every import of xmlrpc will have xmlrpc.client defined. ipykernel, which is used when you are in a notebook, has lots more dependencies than a terminal IPython session, so one of those must have imported it. You can check sys.modules['xmlrpc'] and sys.modules['xmlrpc.client'] to check what’s been imported already.
The invariant holding is that if you have sys.modules[‘spam’] and sys.modules[‘spam.foo’] (as you would after the above import), the latter must appear as the foo attribute of the former.