Skip to content
How to run new file .
Profile icon
choisangyeon

Hi..
May be silly Question...
But I m serious..
I want to make new file like test.py.
When i push Run Button, every time main.py file run.
How can I run my test.py file?
Thank you..

You are viewing a single comment. View All
Profile icon
NotTani

There are a couple ways to do this. The best way is to add import statement to line 1 on main.py. Import statements basically allow you to take variables, functions and classes from another file to your file, but as a side effect, it also runs it. An import statement, on its own line, is the word import followed by a space, then the filename without the .py extension.

So if you wanted to run ggg.py, type import ggg, or if you wanted to import ttest1.py, type import ttest1.

Profile icon
choisangyeon

Thank you very much

@drwhonerd99
..
I solved the problem...
Thanks...

Profile icon
NotTani

@choisangyeon
You are very welcome! Happy coding!

Profile icon
choisangyeon

Hi

@drwhonerd99
.
I have one more Question.
How to run a file under new fold?
Thanks