How can I create my own python module?(a module like random or socket) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I create my own python module?(a module like random or socket)

24th Jan 2020, 1:33 PM
botboss
botboss - avatar
3 Answers
+ 9
You just have to make a regular .py file, put it in the same folder as your program, then import the module by its name, without the .py.
24th Jan 2020, 1:39 PM
HonFu
HonFu - avatar
+ 1
Thank you HonFu
25th Jan 2020, 8:32 PM
botboss
botboss - avatar
+ 1
I am also playing with this concept. A few examples attached. These are not as good as the import modules or embedded functions https://code.sololearn.com/cZP2JtwtnSo4/?ref=app https://code.sololearn.com/c6Tu4Axj7g2n/?ref=app https://code.sololearn.com/cDZ51gwHK398/?ref=app
25th Jan 2020, 11:34 PM
Rik Wittkopp
Rik Wittkopp - avatar