I recently started switching from MATLAB to Python. I'm using PyCharm 2021.2 (Community edition). I'm trying to understand an open-source project written by someone else. Usually in MATLAB, I achieve this by running the script in the debugging mode, and run/read through the code.
Under the debugging mode in PyCharm, I found that is a function is imported as a built-in function/method, sometimes I can't "step in" to that function. For example, I have these lines of code:
from ThisModule import function1, function2
a = 1
b = 2
c = function1(a, b)
Note that "ThisModule" here is not in the current project, it is a library written and stored in other locations on my local computer, but can be read by the interpreter as I put it on the path. I have two questions (1) I found that in this case, under the debugging mode, at the last line of the code, when I try to "Step-In" the "function1", PyCharm does not open its source code in a new tab in the editor. Instead, it just execute this line (step over) without letting me look into what happens in "function1". (2) Another question, is whether there is a way to open the source code (e.g., from command in Python console) of "function1" in this example. For example, in MATLAB, if I want to take a look at the source code of function1, I can just do "edit function1" or "open function1" in MATLAB's command window. I tried loading inspect module and using inspect.getfile(function1) as recommended by some people when I searched about this online, but kept running into errors.