newbie - How do I import automatically?
Mike Meyer
mwm at mired.org
Tue Nov 15 15:58:38 EST 2005
bobueland at yahoo.com writes:
> 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?
Set the PYTHONSTARTUP environment variable to the name of a python
file that does the "from btools import *".
<mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list
mailing list