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

  • Thread starter Shahriar Shamil Uulu
  • Start date
S

Shahriar Shamil Uulu

Dear All,
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.
Thank you ...
 
F

Fredrik Lundh

Shahriar Shamil Uulu said:
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

</F>
 
S

Shahriar Shamil Uulu

Thank you Fredrik Lundh
for your help ...
it worked ...
the problem was in saving of file first.py
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,274
Messages
2,571,368
Members
48,060
Latest member
JerrodSimc

Latest Threads

Top