Ask coding questions

← Back to all posts
its me again! that rando 12 year old.
Imthebestthe (108)

After realising that I am a complete noob when it comes to python coding, I wanted to know how you pros did it. How you guys link to file together and also can you explain how to do that it on repl.it plz? Thx!
edit: when I say link files together, I mean that I have one bit of code doing one thing in a file. Once that is completed it goes into another file and does that bit of code. Sorry I wasn't clear enough originally. Also, sub-question, is it different on an actual python shell. eg idle???
edit 2: can you link two files together that aren't in the same coding language on repl?

Answered by Kwolski (39) [earned 5 cycles]
View Answer
Comments
hotnewtop
Kwolski (39)

Example: so I am going to make two .py files. The first one will be named python.py and the second one python_2.py and in the main I would put import python and it will run whatever code you put in the python.py and then in the main you could put import python_2.py and it should run both files right after each other.

Imthebestthe (108)

@Kwolski you also answered the question. i was so split between you to. thank you so much for the answeres!!!

SixBeeps (5334)

What exactly do you mean by "link to file together"? Do you mean like file IO?

Kwolski (39)

@SixBeeps Yes I agree with you, what do you mean by link files together

Imthebestthe (108)

@Kwolski thanks. if you look on the question you will see that I updated it.

SixBeeps (5334)

@Imthebestthe Okay.
1.) You can create classes and then call a function from that class. I've only used Python a few times, so I don't know exactly how to do it off the top of my head, but it is definitely possible.
2.) You could use a polygott repl, but I'd avoid mixing multiple langs.