This is not implemented yet, though it will be implemented.
There is a partial workaround that might be enough for you now.
(1) Create test.pyx and main.sage as follows:
teragon:tmp was$ more test.pyx
def f(int n):
return n
teragon:tmp was$ more main.sage
print f(3)
(2) You can use main.sage if you do the following:
sage: load test.pyx
Compiling test.pyx...
sage: load main.sage
3
This is now trac ticket #2137:
http://trac.sagemath.org/sage_trac/ticket/2137
William