Ask coding questions

← Back to all posts
Importing files as modules
Electrosolt (3)

How do I import a python file (One that I created through replit) as a module for my main program? I want to be able to categorize my code and use it for other programs without having to make a mess, being able to use functions from a file to make stuff easier. Any idea how I can do this?
Example: https://repl.it/@Electrosolt/File-Module-Test

Answered by AllAwesome497 (367) [earned 5 cycles]
View Answer
Commentshotnewtop
AllAwesome497 (367)

import <filename without extension>
here is an example: https://repl.it/@AllAwesome497/Business-Man-6

Electrosolt (3)

@AllAwesome497 Thanks for the clarification, turns out I was being bad and wrapped the thing in a class instead of just leaving it as normal. :)