Ask coding questions

← Back to all posts
Multiple executable files in the same project
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
JulioRivera1
Nedak
YueEn1
nteasocial
Artemis6969
jinxedfishbones
Yulia5
ShiZhongYu
Coderoftheworld
geofflangenderf
Comments
hotnewtop
ArtemRikoski

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

Stan085

you can make a .replit file and put:

Stan085

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

GaureeshK

please add this feature in repl

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

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

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.

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?

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.

timmy_i_chen

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

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.

CSharpIsGud

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

theangryepicbanana

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