Chathuri Fernando
Chathuri Fernando

Reputation: 972

Executing Python Script and C# Script Parallely on Visual Studio

This is a common question that most people asked already. I go through the lot of documentation that written on different topics how to integrate Python and C#. But most of them are too difficult and can not apply with my requirements.

I have a main program that written on Visual Studio and C#. Also I have another program written in normal Python. I want to run that python script parallely with the C# program. Can anyone tell me how can I perform this task.

Upvotes: 1

Views: 390

Answers (1)

Franco Roura
Franco Roura

Reputation: 817

Try calling Python from IronPython in Visual Studio, you can use it to call Python's native functions, classes, types, methods and it'll compile directly to bytecode. Also, since you have your native functions supported, you will be able to import modules and dependencies as well.

Also, there is

System.Diagnostics.Process.Start("CMD.exe", "python script.py");

Where script.py is your python script and it'll get executed from the cmd, the main difference is that IronPython will compile directly inside your C# script and the second method will run cmd where you'll need to have Python locally installed in order to run the script you're calling.

Upvotes: 1

Related Questions