Correct way to share a module between pycharm projects
已回答
Experienced programmer here but new to Python and Pycharm.
I've developed a program that includes service classes to handle access to an API and a database. Each of these classes is in a separate .py file.
I'm starting a new project now and I want to use these service classes again but without just copying them as I'd like any future service updates to be propagated. I guess the way to do that is to pull them out into a separate "library" project that I can access from the two main projects.
My question is how will I access my modules from this library project? I'm familiar with pulling in "official" modules in PyCharm but how do I pull in my own modules from my own projects?
请先登录再写评论。
You can either add it to your Interpreter Paths https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-reloading-interpreter-paths.html which is the equivalent to adding it to sys.path
Or you can add it as a Content Root https://www.jetbrains.com/help/pycharm/configuring-project-structure.html