Sublime Forum

Open Sublime Text from within my code and load a py file

#1

I have written code in Sublime Text editor and have run the program.
From within the program i want to open Sublime Text editor with a specified file.py
Has anyone example code on how to go about this procedure?
Thanks al

0 Likes

#2

You can do this using the command line interface and python’s subprocess module. See https://www.sublimetext.com/docs/command_line.html#usage.

0 Likes

#3

Thank you. I will use this for my program!

0 Likes

#4

Yes subl is already installed on the Linux system.
I just went into a terminal and typed
subl /home/progs/main.py
It ran by opening the project in Sublime Text.
However I need to do this from with my program.
I am able to select the folder and file from my app and just need to run the subl from within my app.
Any ideas on how I can do this please?

0 Likes

#5

If your app is written in python I already suggested how to do that, otherwise you’ll have to find out how to spawn a process from whatever you’re using.

0 Likes