1

I am using a python file. I want to call another python code. Is there any way by which i can return data from 2nd python code to calling python code. Anything like function returns value to calling function.

1
  • Where's your question? This is a trivial problem (just have the called function return a value), so which part exactly are you having problems with? Commented May 28, 2012 at 8:57

2 Answers 2

4

I must admit I don't see the problem:

test1.py:

def myfunc():
    return "spam!"

test2.py:

import test1
print(test1.myfunc())

Output when running test2.py:

spam!
Sign up to request clarification or add additional context in comments.

Comments

0

Get everything into classes and functions and read a lot about importing modules

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.