-1

I am aware of the difference between import x and from x import yyy, in the latter case one can address x-located functions by bare name, instead of full specification, and this exactly I want to do, I do not want to write full name every time.

Also I know how to redefine default Python dir on Windows so that it starts knowing my developed modules, and this is fine. However how to combine those two things altogether?

I want IDLE to get started knowing all functions from all my modules so I do not need to import them manually.

from * import * 

i.e. for all modules in IDLE home directory?

P.S. I saw this question, however it puts solution only for one import and do not scan the whole dir, also this solution with shortcut parameters does not seem beautiful to me.

Are there any more neat ways?

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
  • 1
    how about writing a small `.py` file that includes all your standard inputs. Then you can just do `from import *` each time you start – FlyingTeller Apr 16 '20 at 15:01
  • and where should I put this `.py` so that IDLE eat it? It dose not execute homedir scripts by default – Suncatcher Apr 16 '20 at 15:03

1 Answers1

2

If you start idle with -r file it will first run the file, or with -s, it will first run the file listed in the IDLESTARTUP or PYTHONSTARTUP environmental variables. Then test by starting IDLE in command prompt with, for instance, py -m idlelib -r file. Once this works, you could create on IDLE shortcut on your desktop (drag and drop from Start menu), open Properties, and add either of the above to the end of the 'Target'.

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
  • Can I put multiple files to `IDLESTARTUP` variable? The caveat here is that my functions lay in different `py` files and I want to feed them all to IDLE – Suncatcher May 19 '20 at 13:02
  • 1
    No. But as FlyingTeller was trying to suggest, you can write one file that imports several. – Terry Jan Reedy May 19 '20 at 13:11
  • So IDLE runs the first file found at IDLESTARTUP and ignores all the rest? It does that by alphabet orde? – Suncatcher May 19 '20 at 14:08
  • I don't understand the question. Environmental variables are strings, not lists of strings. If you pass `-s` to IDLE, it will try to open a file with the name given by the string. The relevant code starts at idlelib.pyshell line 1553. – Terry Jan Reedy May 20 '20 at 01:18
  • `Environmental variables are strings, not lists of strings` [PATH variable](https://en.wikipedia.org/wiki/PATH_(variable)) for example is exactly list (or set) of strings where you can put multiple paths, hence is my question. If this is not the case with `IDLESTARTUP` then OK, I got your idea. – Suncatcher May 20 '20 at 06:10