How to call function which is in one program ...

Kevin Yuan farproc at gmail.com
Tue Dec 20 05:27:00 EST 2005


Another thing to remeber: Make sure the first.py and second.py are locateed
in the same directory OR the path of first.py is in *sys.path*. Otherwise
you'll get an exception.

2005/12/20, Fredrik Lundh <fredrik at pythonware.com>:
>
> "Shahriar Shamil Uulu" wrote:
>
> > i got another questions. For example i have two programs in python
> > like: first.py, second.py.
> > In first.py i have a function test() like:
> > # first.py
> > ...
> > def test(name):
> >      print name
> >
> > .... so other functions
> > =========================
> >
> > #second.py
> >
> > Question is how i can include first.py into second.py and use function
> > test.py.
>
>     # File: second.py
>     import first
>     first.test()
>
> tips: read a Python tutorial *before* you post your next question.  start
> here:
>
>     http://www.python.org/doc/Intros.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051220/0e17cc0d/attachment.html>


More information about the Python-list mailing list