Hi, what I am looking for is a way to always run a single file in Sublime Text 2 when a project is open.
For example if my python project has “pyproj.py”, “foo.py”, and “bar.py” and “pyproj.py” imports foo and bar, I want the program to run “pyproj.py” no matter which file I have active.
I would like this file to be included with my project, so whenever I open the project it will use this behavior.
I found that I could do this in the Build System by creating a new Package directory, ex. PyProj and creating a file within that called pyproj.sublime-build with the contents below:
{
"cmd": "python", "-u", "pyproj.py"],
"file_regex": "^ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
However, this could get old really fast as I create new projects and want to add that single Main file to all of them. My packages directory will quickly become polluted with my projects.
Is there a better way to do this, one that possibly involves keeping all of the project-related files together? For example, maybe in the Project definition file or as a file close to where my source code is stored?
Thank you all.