Is there a way to Preview a CSV file in VSCode programatically?

My program saves a CSV file that I open through VSCode by going to the Explorer pane, right-clicking on the file, and choosing Open Preview on the menu that pops up.

Is there a way to do the same thing from inside my program, so that I do not have to do it manually?

Sorry. I figured it out. In case someone wants to know, it can be done like this:


where df is the dataframe.