Importing modules? | Sololearn: Learn to code for FREE!


Importing modules?

Hi, can someone help me, please? I am using the code playground, on python, and was wondering if you could import modules, and functions from those modules into another python file. Can you import things from your own computer (not in sololearn), do you have to export everything in order to import?

3/12/2021 9:25:15 AM

Kamil Hamid

2 Answers

New Answer


You simply create a file, and import anything from it in another file with exporting. It won't work on sololearn !


s = ''' def greeting(name): print(f'Hello {name}, how are you?') ''' with open('','w') as f: f.write(s) import mymodule mymodule.greeting('John')