An Org mode link is just text (although its appearance may be modified using text properties), so you can add it to any text file, including a python file:
def main(options, args):
# [[file:/path/to/some/file][some file]]
For external links, you can open the link using M-x org-open-at-point. Internal links ...
We write two functions: one to count the number of DONE entries in the drawer and one to add the count as a property to the headline. Here's an example Org mode document delineating the basic assumptions:
* TODO foo
SCHEDULED: <2020-07-07 Tue +1d>
:LAST_REPEAT: [2020-07-01 Wed 16:03]