Importing files as modules
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
michael2008
On a Python or JavaScript repl, you can search for a package to install by clicking on the icon on the sidebar in the workspace. Simply search for the package you want and select it to install the package or to view its documentation. Clicking on the Add Package icon will put it in a spec file and a lock file.
import <filename without extension>
here is an example: https://repl.it/@AllAwesome497/Business-Man-6
@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. :)