I've just finished my course of Python, so now I can write my own script. So to do that I started to write a script with the module Scapy, but the problem is, the documentation of Scapy is used for the interpreter Scapy, so I don't know how to use it, find the functions, etc. 
I've found a few tutorials in Internet with a few examples but it's pretty hard. For example, I've found in a script the function "set_payload" to inject some code in the layer but I really don't know where he found this function. 
What's your suggestion for finding how a module works and how to write correctly with it? Because I don't really like to check and pick through other scripts on Internet.
If I have understood the question correctly, roughly what you are asking is how to find the best source to understand a module. 
If you are using an inbuilt python module, the best source is the python documentation.
Scapy is not a built-in python module. So you may have some issues with some of the external modules (by external I mean the ones you need to explicitly install).
For those, if the docs aren't enough, I prefer to look at some of the github projects that may use that module one way or the other and most of the times it works out. If it doesn't, then I go to some blogs or some third party tutorials. There is no right way to do it, You will have to put in the effort where its needed.
How to read the documentation of a certain module?