I have typical Cython code (.pyx) with an exception that it needs to access the variable from Python module:
helloworld.pyx:
from hellotest import label
def say_hello():
print('Hello world!' + label)
And hellotest.py
from helloworld import say_hello
label = 'some label'
say_hello()
When I try to compile it with usual python setup.py build_ext --inplace, I get an error: Traceback (most recent call last): File "hellotest.py", line 1, in from helloworld import say_hello File "helloworld.pyx", line 2, in init helloworld (helloworld.c:967) from hellotest import label File "/home/dusan/projects/temp/hellotest.py", line 1, in from helloworld import say_hello ImportError: cannot import name say_hello
However, when I just remove label dependency (the very first line in helloworld.pyx and label in print statemet), code compiles and runs fine.
Can someone please tell me, how to access other module from within pyx code? Thanks!