how to use repl
PatriciaMedina (9)

I have created one file in repl using python and it worked. Now I am trying a second file and it is not working. The key words are not even hot. What do I do to create multiple documents??

You are viewing a single comment. View All
timmy_i_chen (1003)

Do you have a link to the repl? And did you remember to include the .py extension for the new file? ;)

PatriciaMedina (9)

@timmy_i_chen ok, did not realize I had to add .py. I am used to my IDE doing it. still will only run the previous file.

PatriciaMedina (9)

@timmy_i_chen is this the link you were referring to? https://repl.it/@PatriciaMedina/dice-game
neither file has anything to do with each other. Just trying to find a work around.

timmy_i_chen (1003)

@PatriciaMedina Oh for your use case you probably want to create a function in the other file and import it into the main file. At least, I think that's what you would want to do?

masfrost (51)

@PatriciaMedina For folders (subpackages), you should add an __init__.py file, for simple cases you can just leave it empty.

Also avoid spaces in your package names, otherwise you have to jump through some hoops. Here's the convention for file names in python.

Here's a simple example https://repl.it/@masfrost/dice-game

Edit: you don't actually need __init__.py, but it makes life easier. See here

Honestly, I'd just leave folders and packages alone if I'm just starting out, and just flatly add .py files on the root directory.