I have the following code:
import json
import os
from botocore.vendored import requests
from custom_validator import CustomValidator
dev_mode = 'DEV' in os.environ
access_token = None
if dev_mode:
import test_config as config
else:
import config as config
def myfunc(data):
if not (access_token):
.....
But inside of myfunc
, I get the Unresolved reference
error when trying to use access_token
.
Even if I put global
before it in the initialization above, I get:
Global variable 'access_token' is undefined in the module level
I'm kind of confused - why is this happening and how can I fix it?
Using Python 3.6.