I have a restful variable that I want to set to a global variable in python.
This code works. It allows the rest of the script to read the_api global the_api
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
the_api = tweepy.API(auth)
print(the_api)
This code does set the_api, but in other functions the_api is undefined... Why can't I vset the_api from within a function in python.
def initTweepy():
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
the_api = tweepy.API(auth)
print(the_api)