How can i run py code in b.py file by using py code in a.py? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i run py code in b.py file by using py code in a.py?

File a.py file=open("b.py") --------------------------- File b.py print ("Hello world")

29th Dec 2020, 11:25 PM
Hushnudbek
Hushnudbek - avatar
12 Answers
29th Dec 2020, 11:49 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 1
First make a function wich prints out hello world. in b.py then in the same directory as b.py create a.py then in a.py: from a import function name. then use it
30th Dec 2020, 4:04 AM
Shadoff
Shadoff - avatar
0
Impossible...
29th Dec 2020, 11:38 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
Possible
29th Dec 2020, 11:39 PM
Hushnudbek
Hushnudbek - avatar
0
There's nothing that's impossible...
29th Dec 2020, 11:41 PM
Hushnudbek
Hushnudbek - avatar
0
Are there any library to do that???
29th Dec 2020, 11:43 PM
Hushnudbek
Hushnudbek - avatar
0
it says: <_io.TextIOWrapper name='b.py' mode='r' encoding='UTF-8'>
29th Dec 2020, 11:43 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
You can change the code
29th Dec 2020, 11:44 PM
Hushnudbek
Hushnudbek - avatar
0
Just run the code in b.py using a.py
29th Dec 2020, 11:44 PM
Hushnudbek
Hushnudbek - avatar
0
I hope you can do that
29th Dec 2020, 11:45 PM
Hushnudbek
Hushnudbek - avatar
0
I need it, please help me, who read the question...
29th Dec 2020, 11:47 PM
Hushnudbek
Hushnudbek - avatar
0
no output.
29th Dec 2020, 11:47 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar