As a developer working in a team, I do the coding in my IDE (PyCharm) but once I want to discuss a line of the code with the team, I go to GitHub/GitLab/Bitbucket/etc and find the code I am working on, and click on the left side that the line number of the code is showing and it generate the URL of the code for me. I send the URL to a team member. A sample URL from an open source project is
(the pic is from JetBrains PyCharm help page)
If invoked when a focus is in the Editor on some line (no repo configured in this test project hence no GitHub option here):
If the above does not do what you need, please check GitLink plugin then: https://plugins.jetbrains.com/plugin/8183-gitlink
A JetBrains plugin providing shortcuts to open or copy a file, directory or commit in GitHub, Bitbucket, GitLab, Gitee Gitea, Gogs, Azure or Gerrit. Custom hosts can also be configured using the URL template syntax.