I don't know how many duplicates of this are out there but none of those I looked at solved my problem.
To practice writing and installing custom modules I've written a simple factorial module. I have made a factorial folder in my site-packages folder containing factorial.py and an empty __init__.py file.
But typing import factorial does not work. How can I solve this? I also tried pip install factorial but that didn't work either. 
Do I have to save my code intended to use factorial in the same folder inside site-packages or can I save it whereever I want?
Greetings
holofox
EDIT: I solved it. Everything was correct as I did it. Had some problems at importing and using it properly in my code...
I think there are several different things to take into consideration here.
When you're importing a module, (doing import factorial), Python will look in the defined PATH and try to find the module you're trying to import. In the simplest case, if your module is in the same folder where your script is trying to import it, it will find it. If it's somewhere else, you will have to specify the path.
Now, site-packages is where Python keep the installed libraries. So for example when you do pip install x, Python will put the module x in your site-packages destination and when you try to import it, it will look for it there. In order to manage site-packages better, try to read about virtualenv.
If you want your module to go there, first you need to create a package that you can install. For that look at distutils or all the different alternatives for packaging that involve some type of building process based on a setup file. 
I don't want to go into details in any of these points because all of them have been covered before. Just wanted to give you a general idea of where to look for.
Install a custom Python 2.7.10 module on Mac