Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports not working in functions, classes #7

Open
susnicek opened this issue Mar 2, 2021 · 0 comments
Open

Imports not working in functions, classes #7

susnicek opened this issue Mar 2, 2021 · 0 comments

Comments

@susnicek
Copy link

susnicek commented Mar 2, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant