How to use swig generated python file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to use swig generated python file

Hi I have generated example_wrap.cxx and example.py from example.cxx file using swig 4.0 Can I use directly a example.py file into other py file? Doing so, I am getting error of missing module. Am I doing something wrong or Am I missing something?

5th May 2024, 1:58 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Answers
0
I am unfamiliar with Swig, but to import one py file into another, either they have to be in the same directory, or the imported file has to be on the python library path (don’t remember the technical name for that folder). You will probably want to do the former.
5th May 2024, 2:09 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
Both file are in same directory
5th May 2024, 2:54 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
You are typing “import example” and not “import example.py”, yes?
5th May 2024, 6:56 PM
Wilbur Jaywright
Wilbur Jaywright - avatar