#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)

lyric swift
#

call a function in a python sscript from a C# script

twilit forge
#

You should rename the title of your post. C is not the same language as C#

lyric swift
#

does C#accept running tasks from other scripts made in other languages? kinda can I call a function?

twilit forge
#

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

lyric swift
#

Can't I get variables from my python script?

twilit forge
#

No

#

It doesn't work that way

lyric swift
#

uhm... oh

twilit forge
#

If you want to interop between the two languages, you have three options

#
  1. Have your Python script print out what it needs to to the console - have your C# end read this

  2. Using IronPython it may be possible to have a bridge between them. Since IronPython is a version of Python that runs on .NET runtime

  3. Just rewrite all the code in one language. Either Python or C#

lyric swift
twilit forge
#

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

lyric swift
#

yeah, anyway thanks for the help

twilit forge
#

You're welcome 👍