Ask coding questions

← Back to all posts
importing files into other ones
westside216 (0)

hey im new to replit, so i'm just wondering, how would I import levelfile to main? for some reason its thinking its a module and not another file, and its really being a roadblock right now

Comments
hotnewtop
Bookie0 (6299)

Yeah, make sure the file has .py at the end, and then use from file_name import *, and change file_name with your file name. The * imports everything from that file, but you can import individual variables, functions, lists, etc. by replacing * with the name of that data type.

:)

westside216 (0)

yeah i just forgot to make it a .py lol
@Bookie0

Bookie0 (6299)

lol I saw yeah I saw that :) @westside216

westside216 (0)

fixed, had to make it a .py file