#does C#accept running tasks from other scripts made in other languages? kinda can I call a function?
1 messages · Page 1 of 1 (latest)
You should rename the title of your post. C is not the same language as C#
does C#accept running tasks from other scripts made in other languages? kinda can I call a function?
To answer your question though, no. Not inherently. C# runs on the .NET runtime, Python is a separate runtime.
You can have C# spin up a Python instance and run a .py file, though
Can't I get variables from my python script?
uhm... oh
If you want to interop between the two languages, you have three options
-
Have your Python script print out what it needs to to the console - have your C# end read this
-
Using IronPython it may be possible to have a bridge between them. Since IronPython is a version of Python that runs on .NET runtime
-
Just rewrite all the code in one language. Either Python or C#
For #1, read docs on how to spin up a new process and read its output: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process?view=net-7.0
For #2, take a look into this: https://ironpython.net/
I think I'm gonna choose the third option, I still didn't even started to write the code, I just asked before going to do something stupid
Third is definitely the easiest, if you haven't written any Python yet
You may as well just keep to one language. It'll save a lot of time
yeah, anyway thanks for the help
You're welcome 👍