Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7719269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:22:27+00:00 2026-06-01T03:22:27+00:00

This is the way i call a .py file within a folder from a

  • 0

This is the way i call a .py file within a folder from a .pyw file outside, i am able to do that successfully, but want to know how can i pass variable from this .pyw file to the .py file within a folder.

if int(verfyUser) == int(Username):
     path = self.application.applicationDirectory
     name = "User_UI"
     path = os.path.join(self.application.applicationDirectory, name)
     if os.path.exists(os.path.join(path, name + ".pyw")):
         filename =  os.path.join(path, name + ".pyw")
     else:
         filename = os.path.join(path, name + ".py")
     args = []
     if ' ' in filename:
        filename = '"' + filename + '"'
     python = sys.executable
     self.close()
     if ' ' in python:
          pythonQuoted = '"' + python + '"'
     else:
      pythonQuoted = python
     os.spawnv(os.P_NOWAIT, python, [pythonQuoted, filename] + args)

i tried to pass the variables in args[], but that’s not the way. Please to help me.
Want to find a way to pass the variable from .pyw to the calling py file.
Hope i am clear…..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:22:28+00:00Added an answer on June 1, 2026 at 3:22 am

    How do you want to pass the variables? Just the values? In that case your approach seems good: you can call the other Python script with the values as command-line arguments. Your other script should then parse the command-line arguments that it has received and utilize them in the code.

    But, just to be sure, you cannot write variable = 3 in the current script, then spawn a separate Python script and then use variable right away somehow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: to cut this short: is there a way to call $kernel->getRootDir(); from within
I want to call this WS http://www.webservicex.net/country.asmx?op=GetCountries What is the best possible way to
I want to utilize a .cgi file in a function call within my model:
I know that all of these will be compiled together into one file but
Often I will send debugging info to my log file from within Java, and
I have a nav.php in my root that I call within each page using
I want to know whether it is possible to use an xml layout file
I'm using the Plupload file uploader within a form. I want to customize it
I would like to call a cron job from within a PHP script. I
What's the best way to reload a tree navigation iframe from within the HTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.