-3

I am trying to access a module I have written in Python from C? Is this at all possible?

I have tried:

Module = PyImport_ImportModule("<modulename>");

But it doesn't seem to work

Oliver.R
  • 1,282
  • 7
  • 17
  • 1
    Hi Chris, and welcome to Stack Overflow. Could you add more information to you question, such as are you using a library? What are you trying to import? What are you expecting to happen? When you say "it doesn't seem to work", in what sense does it not work? With the current information, there's not nearly enough to provide a reasonable answer. If you can edit in more information, people might have more of a chance of getting you the answers you need. – Oliver.R May 18 '20 at 00:48

1 Answers1

1

please try to add more information of what are you trying to do. Anyway, I know it is possible. It isn't easy though.. Have you tried looking for any tutorials? I think this was already asked:

Call a Python function from within a C program

https://www.codeproject.com/Articles/11805/Embedding-Python-in-C-C-Part-I

https://www.linuxjournal.com/article/8497

Nicolas Bazan
  • 65
  • 2
  • 7