How can I find the function of a python module?
<p>I am using OpenCV, and I want to see what the "rectangle" function is. 
I can use the dir(module) function, to get at the function definition, and name, but I don't know how to view the actual function. I am Using Linux (Ubuntu 16.04), and I'm wondering if the libraries are in "/usr/local/" or some other place. The OpenCV cv2 python library is just an example, I want to know how to view any function of a library, imported into python. </p>

<p>There are multiple ways :</p>

<ul>
<li><p>If you want to get the source code on runtime you can use <code>inspect.getsourcelines(object)</code> (see <a href="https://docs.python.org/3/library/inspect.html#inspect.getsourcelines" rel="nofollow">https://docs.python.org/3/library/inspect.html#inspect.getsourcelines</a>)</p></li>
<li><p>If you want to find where the module is you can simply <code>print(module.__file__)</code></p></li>
</ul>

python function opencv module