0

I have a.py which the code is:

#!/usr/bin/env python
#coding=utf-8
def aaa(p):
    m=1
    n=2
    z=m+n+p
    return z

Now i want to get "m" and "n" from a.py in another python script, how should I do?

1 Answers1

0

use import a and then you can use a.m and a.n

If you dont want to use a.m the you should import like from a import m and then use them as they are(m and n). But this way isn't the recommended way, as it would confuse you in identifying which variable is from which file.

I just found a similar question. Have a look.

Importing variables from another file?

Sandesh34
  • 279
  • 1
  • 2
  • 14