How to have PyCharm recognize an import pattern made through the sys.module?

Hi, I had a hard time finding the community guidelines, so pardon if i broke any rules.  Anyway, this from my question at stackoverflow.

This is an over simplification, however with the following folder structure:
    |- apple
    |- orange

The `` is:

The `` is:
    import xmlrpc.melon.some  # -1-  (don't mind my use of xmlrpc)

The `` is: (this is what I run)
    import sys
    import importlib
    apple_mod = importlib.import_module("apple")
    sys.modules["xmlrpc.melon"] = apple_mod
    from orange import hello

This program works ok and outputs the following:

Anyway, my problem is PyCharm.  How can i make it recognize that any submodule from that dot notation of `xmlrpc.melon` points to any package under `/apple`?

Please sign in to leave a comment.