File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed 
src/content/docs/workers/languages/python Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,33 @@ Cloudflare has a wide range of Python examples in the [Workers Example gallery](
1111
1212In addition to those examples, consider the following ones that illustrate Python-specific behavior.
1313
14+ ## Modules in your Worker  
15+ 
16+ Let's say your Worker has the following structure:
17+ 
18+ ``` 
19+ ├── src 
20+ │   ├── module.py 
21+ │   └── main.py 
22+ ├── uv.lock 
23+ ├── pyproject.toml 
24+ └── wrangler.toml 
25+ ``` 
26+ 
27+ In order to import ` module.py `  in ` main.py ` , you would use the following import statement:
28+ 
29+ ``` python 
30+ import  module
31+ ``` 
32+ 
33+ In this case, the main module is set to ` src/main.py `  in the wrangler.toml file like so:
34+ 
35+ ``` toml 
36+ main  = " src/main.py" 
37+ ``` 
38+ 
39+ This means that the ` src `  directory does not need to be specified in the import statement.
40+ 
1441## Parse an incoming request URL  
1542
1643``` python 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments