Python way to write a looping function that can accept customizable functions
Solution 1:
Why don't you just take the action (function) in params?
def loop_through_PDF(filename, action):
...
def some_action(text):
...
loop_through_PDF(..., some_action)