Python Forum
Use Variables Generated from Functions in different files to use on the main file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use Variables Generated from Functions in different files to use on the main file
#4
(Jan-01-2019, 01:55 AM)Larz60+ Wrote: assume a directory structure as follows (change to your specifications)
Output:
MyProject |__src main.py config_x.py mod_x.py
in the MyProject directory and the src directory add two files, both named __init__.py
now modify the __init__.py in MyProject, as below, and leave one in src empty
/MyProject
    __init__.py
    /src
        __init__.py
        config_x.py
        main.py
        mod_x.py
save all and rerun, it works on my end.

results:
Output:
$ python ./src/main.py 5 DO SOMETHING

I managed to do the same thing too now, thank you very much friend. You are a saviour, this is what I was looking for the last 2 days. Thank you very much
Reply


Messages In This Thread
RE: Use Variables Generated from Functions in different files to use on the main file - by AykutRobotics - Jan-01-2019, 04:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can i combine these two functions so i only open the file once? cubangt 4 805 Aug-14-2023, 05:04 PM
Last Post: snippsat
  HOW TO USE C# GENERATED DLL davide_vergnani 2 1,556 Jun-12-2023, 03:35 PM
Last Post: davide_vergnani
  File path by adding various variables Mishal0488 2 964 Apr-28-2023, 07:17 PM
Last Post: deanhystad
  Can I get some clarification on importing functions from external files. wh33t 3 859 Feb-25-2023, 08:07 PM
Last Post: deanhystad
  delete all files and subdirectory from a main folder mg24 7 1,528 Oct-28-2022, 07:55 AM
Last Post: ibreeden
  python run all py files from main py file mg24 6 1,248 Oct-12-2022, 04:41 AM
Last Post: mg24
  using variables with functions imported from different files. Scordomaniac 3 1,216 May-24-2022, 10:53 AM
Last Post: deanhystad
  Formating generated .data file to XML malcoverc 3 1,315 Apr-14-2022, 09:41 PM
Last Post: malcoverc
  Storing variables into one file for use in multiple Jupyter notebooks devansing 1 1,694 Feb-05-2022, 10:04 AM
Last Post: ibreeden
  Functions to consider for file renaming and moving around directories cubangt 2 1,699 Jan-07-2022, 02:16 PM
Last Post: cubangt

Forum Jump:

User Panel Messages

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