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:
The `some.py` is:
The `hello.py` is:
The `run.py` is: (this is what I run)
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`?
This is an over simplification, however with the following folder structure:
|- apple |- some.py |- __init__.py |- orange |- hello.py |- __init__.py |- run.py
The `some.py` is:
print("foo!")
The `hello.py` is:
import xmlrpc.melon.some # -1- (don't mind my use of xmlrpc)
print("bar!")
The `run.py` is: (this is what I run)
import sys
import importlib
apple_mod = importlib.import_module("apple")
sys.modules["xmlrpc.melon"] = apple_mod
print("var!")
from orange import hello
This program works ok and outputs the following:
var! foo! bar!
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.