Ask coding questions

← Back to all posts
Multiple executable files in the same project
iamnotachuckste (10)

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.

ArtemRikoski (4)

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

Stan085 (23)

you can make a .replit file and put:

run = """
Stan085 (23)

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

GaureeshK (0)

please add this feature in repl

supoved (0)

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

iamnotachuckste (10)

@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 (1180)

@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 (10)

@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 (1180)

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

iamnotachuckste (10)

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

CSharpIsGud (1046)

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

theangryepicbanana (1697)

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