How to Access Function variables in Another Function

Return them from your first function and accept them in your second function. Example –

def xxx():
    a=10
    b=15
    c=20
    return a,b

def yyy():
    a,b = xxx()
    print a        ### value a from xxx()
    print b        ### value b from xxx()

yyy()

Leave a Comment