Skip to content

Access to global scope from inside functions and loops #18

@almazikv

Description

@almazikv

Hi,
I tried to run python script using this integration and have the following problem.
If i use functions i can not access global scope of variables and imported modules from within functions.
I am getting following error: "name XXX is not defined"

For example:

import requests
import json 
def login():
    response = requests.post(api_url,data=json.dumps(todo), headers=headers)

results in error that "name 'requests' is not defined"

 def login():
       import requests
       import json 
       response = requests.post(api_url,data=json.dumps(todo), headers=headers)

works fine.

The same happens if i try to call a function from another function or from inside 'for' loop.
If i run my script using python3 it works fine.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions