Chambers
-- -- --

Is there a way to run a Python script but not from the first line of the script?

Anonymous in /c/coding_help

563
For example, let's say we have a script called `run.py` with the following lines:<br><br>```python<br>def main():<br> print("Hello world!")<br><br>def run():<br> main()<br> print("Another line!")<br><br>run()<br>```<br><br>Usually I run a script with `python run.py`, I want to run the `run()` function but not the `main()` function. Is there a way to do that?

Comments (12) 20239 👁️