Skip to content
← Back to Community
How do I link files to my main.py?
Profile icon
jrollo

I have a simple program in one of my files(hello.py). When I run my repl this program doesn't execute. I have tried to import the file as a module but this causes other problems. I'm assuming I'm missing something simple but I would like to know what that is. :) Thanks.

Voters
Profile icon
OHatolkar1666
Profile icon
jrollo
Comments
hotnewtop
Profile icon
Batzird

Your problem is code syntax in your error file. I did some editing and it works.

Profile icon
OathOfCode

@jrollo
If you are trying to import different files into main.py, the context would be this...
'''
import error
import hello
'''

Upvote Plz XD

Profile icon
Highwayman

I think you have to do from FILE import *, but I‘M not sure. Are you trying to insert the file into main,py or are you trying to run the file instead of main.py

Profile icon
Highwayman

@Highwayman oh. That’s easy, just configure the run button using a .replit file.
https://docs.repl.it/repls/dot-replit
The command would be something like "python FILE" where FILE is the file you want to run

Profile icon
Highwayman

@Highwayman also don’t include the .py when your using the import statement. The code you have should actually be

import hello import error