When ran from a terminal, sys.argv[0] is the path of current script, but in python interactive that variable points to "/some/path/ipykernel_launcher.py" which is a temporary file.
How do I get the path of current script (which I am editing in vscode)? I need this information because whenever I create a file, I automatically log which script created it. For that, I overload the open() function to automatically log the creation. But when file is created from a python interactive session, I am missing such information.