With some further testing regarding the issue, I have been able to
replicate the problem, with the relative links setting in org babel
being ignored, using "emacs -Q" on Ubuntu with the emacs version
installed from their package repository.
The test.org file is the same as before, and again the absolute path of
the folder being shown in the link comments in the output test.py file:
# [[file:~/mytest/test.org::*My%20top%20level][My top level:1]]
print("This is my code")
# My top level:1 ends here
Here is the bug report system info:
Emacs : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
of 2020-03-26, modified by Debian
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @
/usr/share/emacs/26.3/lisp/org/)
I was also able to replicate the problem using the bleeding edge version
of org mode, with the same absolute path result as above. The bug report
system info reports this org mode version:
Package: Org mode version 9.3.7 (release_9.3.7-627-g0eeee1 @
/home/test/elisp/org-mode/lisp/)
Let me know if I can provide any further information, thank you very
much for your help.