Possible to call Python from C++ in Kicad source code?

I am trying to call a Python script from inside one of the files in Eeschema. Has anyone tried this already? I am using the Embedded Python to C++ documentation (https://docs.python.org/3/extending/embedding.html).
Thank you.

Are you planning to modify the eeschema source code?

Yes. I am. Do you have experience with modifying the code?

Good question! :slight_smile:

1 Like

Oh! I’m sorry. I didn’t realize! I apologize for the silly question.

Well i would say he needs a flair :wink: Tagging @Joan_Sparky to make that happen.

1 Like

I hope you don’t mind the attempt at humor. Please DM me if you’d like it deleted. In the meantime, you should ask your original question!

1 Like

Haha no worries! I appreciate it actually :slight_smile:
My original question is that I am trying to “create” my own dialogue widget in Eeschema and since I need to call a python script, I was wondering if it was possible to call Python from inside the C++ code.

1 Like

No worries;) I just wanted to be sure of your intentions. You will get plenty of useful information on the official website and I recommend joining the developers mailing list which is a great place to ask code related questions.

Anyway, I assume you do not want to develop a generic scripting interface a’la pcbnew, right? Just a quick hack to run a bit of Python code upon a certain action?

Thank you. I will join the mailing list!
Yes, I do not want to use pcbnew. Just a quick way to run Python code !

I think the way you proposed in the first post might be the simplest one for your needs. Good luck!

1 Like

What is the road-map for the more complete Python generic scripting interface a’la pcbnew in eeschema ?

Okay. Thank you very much! :slight_smile:

IMHO, scripting support in pcbnew cannot be considered complete at the moment. It is too tightly bound with the C++ interfaces, meaning the scripts will break anytime we change the function signatures. Eeschema needs to undergo the model refactor (planned for v6) before we can even think about adding a scripting interface there.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.