How do i import python files? #1326
-
Hi Thanks for the awesome library, i've got my rust py03 project published and can import the rust functions, i followed: I found another issue which explained that you need to import rust by in the init.py in location mentioned above If i want to wrap the rust function in python and then make that python importable, how would i do that |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Sorry what you described is hard to follow without real code. |
Beta Was this translation helpful? Give feedback.
-
My apologies. Ok so ive got a folder called nameofrustlibrary which is as described in the docs at the same level as cargo.toml in my init.py i have: from nameofrustlibrary import * here is some example code like the contents of wrapper: import nameofrustlibrary;
When i build this i can do: then i can do But when i do this i get an error that: init is the py03 function that im trying to call from the python code. |
Beta Was this translation helpful? Give feedback.
-
Ok ive got this working, thanks. What was confusing was that the docs say to use from .nameofrustlibary import * to get the rust functions imported but actually when the project folder is nested inside the python folder, what works is from nameofrustlibary import wrapper |
Beta Was this translation helpful? Give feedback.
Ok ive got this working, thanks.
What was confusing was that the docs say to use from .nameofrustlibary import * to get the rust functions imported but actually when the project folder is nested inside the python folder, what works is from nameofrustlibary import wrapper