+ 10

[INFORMATION] YOU CAN IMPORT ONE PYTHON CODE TO ANOTHER HERE ON SOLOLEARN ( Hooray!😅)

Hey everyone! If you've worked with Python here on SL, you're likely to have faced an issue about importing your one python code to another as a package or may be just to reuse some functionalities from your previously created code, as there's no official way to link your multiple codes in here and that's painful 😔. Recently I've been coming across too many queries about importing a local code to some other code and I've been answering them like "Sadly that's not possible here on SL". Well, that's all going to change now. I've created this https://code.sololearn.com/cLBKf4Dy7t2i/?ref=app very small piece of code today which will let you do that. All you need is to: 👉Copy-paste the code snippet in your python code in which you need to import. 👉Replace the 'url' with the url of your code from the code playground which you need to import. 👉 And voilà ! 😅 Thanks to Anna and Flandre Scarlet, their ideas were helpful!😊 Kindly let me know if you find any bugs. Happy Pythoning 🐍!

4th Apr 2019, 6:53 PM
Шащи Ранжан
Шащи Ранжан - avatar
2 Answers
+ 6
This is great if it works. Perhaps it is possible for other languages too?
5th Apr 2019, 12:30 AM
Sonic
Sonic - avatar
+ 3
Sonic It works. I've my two codes currently using this technique 😅. Did you mean accessing other languages' code in Python? Yep, you can access other languages' codes in Python as well. All you need is to change the extension for file from .py to the one in which the code is written. Or did you mean the idea? If there's a way to get the whole html content of the page, then yea, it'll work on other languages as well.
5th Apr 2019, 1:15 AM
Шащи Ранжан
Шащи Ранжан - avatar