newbie - How do I import automatically?
claudio.grondi at freenet.de
Thu Nov 17 11:21:40 CET 2005
Thanks to "Serge Orlov" for the hint:
"run C:\Python24\Lib\idlelib>idle.py -h"
Following works for me now
if I start IDLE by following console command:
C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -c "import os;from
path import path"
The IDLE console prompt appears in the second line
(so -c "import os;from path import path"
probably fakes execution of an input line)
and os and path modules are available for usage.
To be honest I don't like this solution and the solution with setting any
I would be much more happy to understand how I can modify PyShell.py or
another script file IDLE uses in order to achieve same effect.
<bobueland at yahoo.com> schrieb im Newsbeitrag
news:1132085329.154028.71780 at g47g2000cwa.googlegroups.com...
> When I start Python Shell I can see that some names or loaded
> automatically, ready for me to use
> >>> dir()
> ['__builtins__', '__doc__', '__name__']
> I have written some functions in a file called btools.py. I would like
> to import them automatically when I start up Python shell. Today I must
> do it by hand like this
> >>> from btools import *
> >>> dir()
> ['__builtins__', '__doc__', '__name__', 'func1', 'func2', 'func3']
> Is there a way to do this automatically so that I always have 'func1',
> 'func2' and so on available, without me having to do it by hand?
More information about the Python-list