with open('file.py', 'r') as f:
    src = f.read()
tree = ast.parse(src)
for child in tree.body:
    if isinstance(child, ast.Assign):
        for target in child.targets:
            members.append(target.id)
print(members)
Get ordered list of attributes of a Python module