473,320 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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 ...

Dec 20 '05 #1
2 1105
"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

</F>

Dec 20 '05 #2
Thank you Fredrik Lundh
for your help ...
it worked ...
the problem was in saving of file first.py
Fredrik Lundh wrote:
"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

</F>


Dec 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
5
by: Seong-Kook Shin | last post by:
Hi, I'm reading Steve's "C Programming FAQs" in book version, and have two question regarding to Q11.16 ... Also, a `return' from `main' cannot be expected to work if data local to main might be...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
3
by: balakrishnan.dinesh | last post by:
hi frndz, I need to call a C program function from php code, Is that possible, If it is ,then tell me how ? i.e,main() { int callfunction(); int i=2; callfunction(i); } callfucntion(int i)
6
by: =?Utf-8?B?Sm9lbWFuYw==?= | last post by:
Hi, I'm trying to figure out the Callback method. I have a .dll that I call from a sub in my unmanaged code/calling program. That works just fine. But I'd like to have the .dll finish doing it's...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.