I would like to know if there is anyway to profile only a function in a python script which does not have a main(). I have a script which will be called by another one. But i want to know the loopholes in it.
I first use the commmand kernprof -l -v filename.py
and then python -m line_profiler filename.py.lprof
I have added @profile before the function.