I have 2 python repls: Login authentication, and a hangman game.
Once a user has successfully logged in and confirm that he wants to play, Is there a way that my hangman game will run automatically? I’ve been googling, but cant find the right answer
Repl link: https://replit.com/@QBrd1/ProjectLoginWithHash#main.py
if Game=="y".lower():
##insert game here
##--how to add---https://replit.com/@QBrd1/Hangman
else:
I don’t know of a way to link two Python Repls. You can make Repl A into a PyPi package and Repl B import the package but that is complicated and would not be effective.
2 Likes
I’m still starting out, and doesnt know enough of Py and making a package. I might just delete it then. Thanks though!
You could put two Py files in one Repl if you wanted. That is easy to do.
# File "other.py"
def fun():
print("Something")
# File "main.py"
from other import fun
fun()
1 Like
What am i doing wrong?
#Hangman.py file
def game():
#rest of the code
#main Py file
import os, random, time
from replit import db
from Hangman.py import game
Line 60
if Game==“y”.lower():
game()

The code in Hangman.py
following def game():
is not indented. Python is whitespace sensitive. I looked at your code, and you have two functions called game
in Hangman.py
. Try deleting line 1. That should do the trick.
Done. I changed the subroutine game() to fun() and indented all code below it.
But do i have to install something? Its throwing me another one.
Change the import to just Hangman
instead of Hangman.py
.
Let’s use your import for these examples.
When you include the .
in the import name, python tries to import the requested import from one of two places:
- (Higher priority) From a file with the name
Hangman
it tries to find py
, then import fun
from py
.
- (Lower priority) From a folder called
Hangman
it tries to find a file called py.py
, then import fun
from that.
3 Likes
Thank you for pointing it out, and explaining it in detail!
1 Like
hold on @CoderElijah @Firepup650
this was a school assignment and the thing he needed to do was make separate files for import ;-;
We didn’t know that until just now.
2 Likes
I know but I probably should have asked xD also we should have asked for the repl link because it was really hard to do it without it
@AshWinters Please mark this as solved if we solved your problem and please don’t let people give you the answers to school assignments. We are only allowed to point you in the right direction.
3 Likes
oh I’m dumb I can’t read sorry
2 Likes
Preferably, mark whichever post you found the most helpful as the solution.
2 Likes
Is it an issue that its for my assignment? 
1 Like
No worries! Thanks either way!
1 Like
yes it is an issue that it is for the assignemnt
1 Like
It should have been at least mentioned, because we are only allowed to give hints as to how to resolve your problems when it is assignments.
2 Likes