aoloe / cpp-pybind11-playground

Creating a Scripting Egnine with pybind11. Step by step. https://github.com/pybind/pybind11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Imports not working in functions, classes

susnicek opened this issue · comments

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