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?

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

import <filename without extension>
here is an example:

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. :)