I've followed pycharm documentation to set up the IDE to resolve imports. However it seems that each folder containing *.py files needs to be explicitly added as 'sources root' in order for the IDE to resolve all references. Can this be done recursively from a root folder?
Is this the correct way to get the IDE to resolve all codebase references, or have I not set up my project structure correctly?
I have already followed other methods for resolving references in the IDE here and here but to no avail. It seems that the IDE will only resolve them if I manually add each folder as a 'sources root'. Without the recursive functionality, large codebases will be laborious when setting up the IDE!
If you have not used __init__.py
, you should add it in each sub-directory to mark it as a package. By adding it, Python will treat the directories as containing packages making you modules visible to other directories and therefore able to be imported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With