I am using sublime text 2 for python and I want to run a function that I made. So in idle if you want to run a function you just type in the name, function(x,y) and it runs the function after pressing F5. When I try this in the interpreter, after pressing ctrl b, in sublime it doesn't work, how to I run functions sublime?
Asked
Active
Viewed 1,455 times
0
-
2Sublime text is a text editor, you have to look at the software you're developping in a browser (if it's web) or something else. There is no "preview" mode in sublime text 2 by default – Yann Chabot Nov 17 '15 at 21:59
-
1I think, generally, you're looking for this answer: http://stackoverflow.com/questions/8551735/how-do-i-run-python-code-from-sublime-text-2?rq=1 – khtad Nov 17 '15 at 22:01
-
1If you want to run Python code, *make sure the file is saved first*. – MattDMo Nov 17 '15 at 23:38
-
I did the update that khtad mentioned, and the file is saved. I have the code def function(x,y) and the next line is return x+y. Its not on one line, its in the right format. Then I go to view\show console. That shows the interperater at the bottom of the page where you can type. I typed function(2,2), and I got an error that says :NameError: name 'function is not defined – user5574068 Nov 19 '15 at 01:31