Imports not working in functions, classes
susnicek opened this issue · comments
susnicek commented
Dear developers,
I am new in pybind11 and I encountered following simple problem: consider the example "eval-file" - if I change the script "set-the-y.py" as follows:
import sys
def print_version():
print(sys.version)
print_version()
set_the_answer(y - 1)
I got an error in function 'print_version'
NameError: name 'sys' is not defined
This is very strange for me, please can anybody explain me what is wrong? How to make the code above operational?
Thank you in advance for your replies! Susnicek