Python Forum
How to skip to a different line while importing a different script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to skip to a different line while importing a different script
#1
Hi! I was coding a program as a little side project that I work on in my spare time and I found a sort of, unwanted occurrence in my program. I want the code to go to the line after I imported another file, and instead, it sends me to the beginning of the file.
Here's the code (main.py to be precise):
print("Good evening ladies,gentlemen and all other configurations of being! I'm Alastor, the radio demon!")
print("I have called you here because of your impeccable skills as a thief")
ans = input("SO, will you join me on this quest of epic       proportions?")
if ans == "no":
    print("Ahaha, this isn't a choice my friend, I shall hold this over your head for later!")
    stubborn = True
else:
    print("Alright! Let's get to work")
    stubborn = False
import choice
print("Great! the guards left should we go in now")
if stubborn:
  print("I don't need to ask do I, we're heading in anyways")

else:
  ans = input("So, should we go inside?")
  if ans == "yes" or "Yes":
    print("Yes! Alright, we're heading in.")
    indecisive = False
    assertive = False
  elif ans == "no" or "No":
    print("Ahaha,too late my friend, i'm already walking in. ")
    indecisive = False
    assertive = True
  else:
    print("Indecisive eh? I'll keep that in mind")
    indecisive = True
    assertive = False
and here's the second file's code (choice.py):
def breakin():
  print()
  print("Ok! We're here")
  br = input("How will we get inside sneak in:  bust in or wait!")
  if br == "sneak in":
    print ("*You snuck in at night from the ceiling*")
  elif br == "bust in":
    print("I was hoping you'd say that lets go!")
  elif br == "wait":
    print("*you waited for the guards to leave*")
    import main  
breakin()
And it starts from the beginning.
Thanks!
Reply


Messages In This Thread
How to skip to a different line while importing a different script - by kat_gamer - Feb-03-2021, 01:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help, a script line is skipped kucingkembar 5 1,485 Dec-29-2021, 07:34 PM
Last Post: deanhystad
  need to skip password prompt, continue... tester_V 2 1,499 Oct-19-2021, 05:49 PM
Last Post: tester_V
  Delimiters - How to skip some html tags from being translate Melcu54 0 1,675 May-26-2021, 06:21 AM
Last Post: Melcu54
  How to skip a folder directory in a loop mfkzolo 2 12,656 Nov-18-2020, 07:56 AM
Last Post: mfkzolo
  read the first line in my script chubbychub 1 1,783 Nov-09-2020, 03:18 AM
Last Post: Larz60+
  How to skip LinkedIn signup link using python script? Mangesh121 0 1,814 Aug-26-2020, 01:22 PM
Last Post: Mangesh121
  importing a list of numbers into python script barrypyth 8 4,654 Aug-22-2020, 09:10 PM
Last Post: barrypyth
  How to calculate column mean and row skip non numeric and na Mekala 5 4,991 May-06-2020, 10:52 AM
Last Post: anbu23
  Functions, skip an arugment SpongeB0B 2 2,136 Mar-27-2020, 12:10 PM
Last Post: SpongeB0B
  Skip a line doug2019 4 3,187 Oct-09-2019, 06:56 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020