Skip to content
Sign upLog in
← Back to Community

Multiple executable files in the same project

Profile icon
iamnotachuckste

Is there a way - or plans to have a way - to have multiple executable programs in the same project (e.g. a main program and a companion script or two programs that are very closely related)? Currently I can add another .py file to one of my Python repls but I can't run it.

Voters
Profile icon
ShashankaSharma
Profile icon
AlexanderKim18
Profile icon
FabreLambeau
Profile icon
cgvgPoliTo
Profile icon
JulioRivera1
Profile icon
Nedak
Profile icon
YueEn1
Profile icon
nteasocial
Profile icon
Artemis6969
Profile icon
jinxedfishbones
Comments
hotnewtop
Profile icon
ArtemRikoski

Not having such an extremely simple and obvious option is pathetic.

Profile icon
GulliverM

you can make a .replit file and put:

run = """ python3 file1.py python3 file2.py """
Profile icon
GulliverM

you might need language = "python3" at he start tho

Profile icon
GaureeshK

please add this feature in repl

Profile icon
supoved

I was surprised, this feature is not there.
It is a convenience feature, but the whole 'repl.it' is convenience product, so it is must have imho

Profile icon
timmy_i_chen

If you import a file, you can run it :)

See example: https://repl.it/@timmy_i_chen/multi-files-demo

EDIT: Here's a better demo: https://repl.it/@timmy_i_chen/multi-files-demo-futures

Profile icon
iamnotachuckste

@timmy_i_chen Nice to know, for my specific use case.
Will there be a method that works with general languages instead of just the ones people have commented that allow reading from/importing files?
My original question was intended to be more about being able to choose a program to run with the Run button.

Profile icon
timmy_i_chen

@iamnotachuckste
It's something we want to eventually be able to do. I'm curious what your use case is? Would creating another repl to run the other file work or is it more a convenience thing?

Profile icon
iamnotachuckste

@timmy_i_chen Convenience-based, mostly. The idea is to be able to group programs that work closely together or simply aren't distinct enough to warrant separate projects. As it is now I either have to write much of the same code twice or switch out the parts that are different.

Profile icon
timmy_i_chen

@iamnotachuckste
Got it, thanks - this is all good feedback :)

Profile icon
iamnotachuckste

@timmy_i_chen (Apologies for necroing this post)
In case you wanted an example of what I was talking about, take a look at https://repl.it/@iamnotachuckste/A065191-family.
Currently, I have to copy-paste one of the four scripts into main.py before running it, since the Run button only targets main.py.

Profile icon
trottersfly

@timmy_i_chen thx

Profile icon
CSharpIsGud

You could probably rename executables and use something like os.execute or whatever you run terminal commands with to run it

Profile icon
theangryepicbanana

I don't think so, but you could imitate something like that in Ruby:

eval File.read("main-2.rb")