5

I'm developing a python project with multiple files, it's annoying that I have to select the file where main is described and called before click run because if not Spyder3(Anaconda) runs the current selected file.

How can I do to run my project from main() in mainPrjPy.py independent if the file is opened and selected?

Thanks

EDIT: I want to explain that I'm using Spyder as Matlab substitute for Physics and math simulation for electronic design, this project would grow with different people generating different algorithms and data processor.

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
taquionbcn
  • 543
  • 1
  • 8
  • 25
  • I'm not sure there is a practical way to set this up, or why it's an issue. Just keep the file with your overall entry point open as a tab and switch to it before clicking run. The default behaviour seems massively more practical to me. – roganjosh Jun 20 '18 at 09:02
  • 1
    Yhea..., you are right, it's not an issue, but if I'm working in a file it's 3 or 4 levels away from the main, I change code and press F5 and... shit I didn't select the main tab. I'm used to program, embedded devices or FPGAs where you run the project not a file(script). My conclusion of this is that spyder is not meant to do projects only little scripts, because I want to run the project no one of its files. But hope there is a way to do that. – taquionbcn Jun 20 '18 at 09:39
  • "My conclusion of this is that spyder is not meant to do projects only little scripts" tell that to the 40,000 line project I've just built in Spyder :) Pycharm may be better suited to your desired behaviour (though I haven't used it much). But some of that assertion may be correct - Spyder is geared more to scientific computing due to the iPython console. An IDE more suited to large-scale applications will probably not have such features easily accessible. – roganjosh Jun 20 '18 at 09:43
  • hehehe, yes I get to spyder because I didn't want to use matlab or octave and most important python is compatible with ROOT(CERN) via pyROOT. Maybe with time I found this way of working very natural and would eat the sentence you quoted me. – taquionbcn Jun 20 '18 at 09:50

2 Answers2

4

Found a way to do this: Use "Run Again Last file" Shortcut key F6 on windows.

It's working fine on Spyder 3.3.6

Roopesh
  • 43
  • 1
  • 4
3

(Spyder maintainer here) We don't have this functionality at the moment (November 2019), sorry.

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124