1
votes

I am not sure if this is a Python or a PyCharm question. I think that it is quite simple, but I could not find a solution anywhere.

I have started to write a collection of modules with utility stuff. Now I want to import one of my packages in several of my other projects. What do I have to do to be able to simply write import my_module, so that Python finds the right one automatically?

I would like to set this up on a Mac and a PC, so advice on both platforms is appreciated.

1

1 Answers

4
votes

It's not pyCharm issue. You have to give python information of the place your module live, to do that update PYTHONPATH, if you're using bash (OS X,GNU/Linux distro), add this to your ~/.bashrc or ~/.bash_profile

export PYTHONPATH="${PYTHONPATH}:/path/to/my_module"

Also you can checkout that article How do I set PYTHONPATH and SO How to use PYTHONPATH question to get more info.

To avoid duplicating answer adding a link to give info of how to update PYTHONPATH on Windows: How to add to the pythonpath in windows 7?

After you should be able to import your module.